|
|
вернуться в форумwrong answer #7. Please give me test...My code : import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Park1796_ { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int a[] = new int[6]; int max = 999999999, k = 0; for (int i = 0; i < a.length; i++) { a[i] = in.nextInt(); if (a[i] != 0 && a[i] < max) { max = a[i]; k = i; } } int b = in.nextInt(); int sum = 0; sum += a[0] = 10 * a[0]; sum += a[1] = 50 * a[1]; sum += a[2] = 100 * a[2]; sum += a[3] = 500 * a[3]; sum += a[4] = 1000 * a[4]; sum += a[5] = 5000 * a[5]; switch (k){ case 0: k = 10; break; case 1: k = 50; break; case 2: k = 100; break; case 3: k = 500; break; case 4: k = 1000; break; case 5: k = 5000; break; } int l = 0, d = sum - k; int count = 0, f = 0; f = d / b + 1; while (f * b <= sum && f * b >= d){ out.print(f + " "); count++; f++; } System.out.println(count); out.flush(); } } Edited by author 19.02.2015 03:01 |
|
|