Задача Suitcases Load
При решаване на задача Suitcases Load Judge ми дава една грешка Test#2 (Runtime error).
Кода е по долу. Ако може някой да помогне!
import java.util.Scanner; public class SuitcaseLoad { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double volRemain = Double.parseDouble(scan.nextLine()); String volumeSuitcase = ""; double volSuitcase = 0.00; int counter = 0; int a =0; int b = 1; while (true) { volumeSuitcase = scan.nextLine(); if (volumeSuitcase.equals("End")) { break; } volSuitcase = Double.parseDouble(volumeSuitcase); if (volRemain < volSuitcase) { a = 1; break; }else if (volRemain == volSuitcase && b == 1) { if (volRemain != 0) { counter++; } a = 1; break; } counter++; if (counter % 3 == 0 && counter !=0) { volSuitcase = volSuitcase * 1.10; } volRemain = volRemain - volSuitcase; b = 0; } if (a == 1) { System.out.println("No more space!"); System.out.printf("Statistic: %d suitcases loaded.", counter); } else if (volumeSuitcase.equals("End")){ System.out.println("Congratulations! All suitcases are loaded!"); System.out.printf("Statistic: %d suitcases loaded.", counter); } } }