Тема: Алготестер задача №1503. Вітрян та будильник
http://algotester.com/uk/ArchiveProblem … File/40679
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Battery_power battery_power = new Battery_power(in.nextInt(), in.nextInt());
battery_power.possibility();
}
}
class Battery_power {
private static int alarm;
private static int sum_min_power = 0 , sum_max_power = 0;
public Battery_power(int n, int alarm) {
this.alarm = alarm;
Scanner in = new Scanner(System.in);
for (int i = 0; i < n; i++){
sum_min_power += in.nextInt();
sum_max_power += in.nextInt();
}
}
public static void possibility(){
if ( sum_max_power < alarm) {System.out.println("Impossible"); return;}
if ( sum_min_power >= alarm) {System.out.println("Certainly"); return;}
System.out.println("Possibly");
}
}
Не розумію у чому проблема. Дякую за допомогу!