結果
問題 | No.1015 おつりは要らないです |
ユーザー | ntk3264 |
提出日時 | 2020-04-04 16:06:01 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,139 bytes |
コンパイル時間 | 2,113 ms |
コンパイル使用メモリ | 73,956 KB |
実行使用メモリ | 63,860 KB |
最終ジャッジ日時 | 2023-09-16 05:44:12 |
合計ジャッジ時間 | 19,559 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
55,852 KB |
testcase_01 | AC | 121 ms
56,024 KB |
testcase_02 | AC | 120 ms
56,108 KB |
testcase_03 | AC | 123 ms
56,112 KB |
testcase_04 | AC | 122 ms
55,548 KB |
testcase_05 | AC | 123 ms
56,220 KB |
testcase_06 | AC | 123 ms
55,960 KB |
testcase_07 | AC | 122 ms
56,040 KB |
testcase_08 | WA | - |
testcase_09 | AC | 119 ms
56,116 KB |
testcase_10 | AC | 635 ms
62,968 KB |
testcase_11 | AC | 651 ms
63,860 KB |
testcase_12 | AC | 664 ms
61,368 KB |
testcase_13 | AC | 640 ms
63,032 KB |
testcase_14 | AC | 671 ms
62,976 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 631 ms
60,924 KB |
testcase_21 | AC | 604 ms
61,260 KB |
testcase_22 | AC | 623 ms
60,796 KB |
testcase_23 | AC | 598 ms
61,324 KB |
testcase_24 | AC | 617 ms
61,520 KB |
testcase_25 | AC | 630 ms
60,708 KB |
testcase_26 | AC | 635 ms
61,188 KB |
testcase_27 | AC | 656 ms
59,512 KB |
testcase_28 | AC | 592 ms
61,940 KB |
testcase_29 | AC | 595 ms
60,924 KB |
testcase_30 | AC | 121 ms
56,076 KB |
testcase_31 | AC | 476 ms
60,488 KB |
testcase_32 | AC | 468 ms
60,808 KB |
testcase_33 | WA | - |
testcase_34 | AC | 121 ms
55,728 KB |
testcase_35 | AC | 121 ms
55,576 KB |
testcase_36 | AC | 119 ms
55,572 KB |
ソースコード
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); int z = sc.nextInt(); int[] arr = new int[n]; for (int i=0; i<n; i++) arr[i] = sc.nextInt(); int max = 0; label: for (int i=0; i<n; i++) { if (z==0) break label; if (arr[i]>=10000) { int cnt = arr[i]/10000; int remain = arr[i]%10000; if (z<cnt) cnt = z; z -= cnt; arr[i] -= cnt*10000; if (remain==0) arr[i] += 1; } } Arrays.sort(arr); if (z>0) { label: for (int i=n-1; i>=0; i--) { arr[i] = 0; z--; if (z==0) break label; } } label: for (int i=0; i<n; i++) { if (y==0) break label; if (arr[i]>=5000) { int cnt = arr[i]/5000; int remain = arr[i]%5000; if (y<cnt) y = cnt; y -= cnt; arr[i] -= cnt*5000; if (remain==0) arr[i] += 1; } } Arrays.sort(arr); if (y>0) { label: for (int i=n-1; i>=0; i--) { arr[i] = 0; y--; if (y==0) break label; } } label: for (int i=0; i<n; i++) { if (x==0) break label; int cnt = arr[i]/1000; if (arr[i]!=0) x -= (cnt+1); arr[i] = 0; } int cnt = 0; for (int i=0; i<n; i++) { if (arr[i]==0) cnt++; } // for (int i=0; i<n; i++) { // System.out.println(arr[i]); // } // System.out.println("cnt" +cnt); if (cnt==n) { System.out.print("Yes"); } else { System.out.print("No"); } } }