Java lab | 7." Магазин за детски играчки". Judge
Здравейте, някой може ли да ми разясни защо в единият случай не мога да изкарам максимален брой точки в Judge ?
Вариант 1 ( при който получавам 90/100 точки в judge въпреки че работи перфектно, когато я стартирам в IntelliJ) "package september19; import java.util.Scanner; public class ex7 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double excursionPrice = Double.parseDouble(scan.nextLine()); int puzzles = Integer.parseInt(scan.nextLine()); int dolls = Integer.parseInt(scan.nextLine()); int teddyBears = Integer.parseInt(scan.nextLine()); int minions = Integer.parseInt(scan.nextLine()); int trucks = Integer.parseInt(scan.nextLine()); double moneyTaken = (puzzles * 2.60) + (dolls * 3.00) + (teddyBears * 4.10) + (minions * 8.20) + (trucks * 2.00); if ((puzzles + dolls + teddyBears + minions + trucks) >= 50) { moneyTaken *= 0.75 ; } moneyTaken *= 0.90; if (moneyTaken > excursionPrice) { moneyTaken -= excursionPrice; System.out.printf("Yes! %.2f lv left.", moneyTaken); } else { excursionPrice -= moneyTaken; System.out.printf("Not enough money! %.2f lv needed.",excursionPrice); } } }" Вариант 2 ( при който получавам 100/100, след като съм ги разменил) "package september19; import java.util.Scanner; public class ex7 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double excursionPrice = Double.parseDouble(scan.nextLine()); int puzzles = Integer.parseInt(scan.nextLine()); int dolls = Integer.parseInt(scan.nextLine()); int teddyBears = Integer.parseInt(scan.nextLine()); int minions = Integer.parseInt(scan.nextLine()); int trucks = Integer.parseInt(scan.nextLine()); double moneyTaken = (puzzles * 2.60) + (dolls * 3.00) + (teddyBears * 4.10) + (minions * 8.20) + (trucks * 2.00); if ((puzzles + dolls + teddyBears + minions + trucks) >= 50) { moneyTaken *= 0.75 ; } moneyTaken *= 0.90; if (moneyTaken < excursionPrice) { excursionPrice -= moneyTaken; System.out.printf("Not enough money! %.2f lv needed.",excursionPrice); } else { moneyTaken -= excursionPrice; System.out.printf("Yes! %.2f lv left.", moneyTaken); } } }"
Ясно, мерси