結果
問題 | No.1015 おつりは要らないです |
ユーザー | cnt_fo |
提出日時 | 2020-04-03 22:58:57 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,596 bytes |
コンパイル時間 | 2,517 ms |
コンパイル使用メモリ | 76,480 KB |
実行使用メモリ | 58,060 KB |
最終ジャッジ日時 | 2023-09-16 04:11:43 |
合計ジャッジ時間 | 9,784 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
49,536 KB |
testcase_01 | AC | 43 ms
49,984 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 44 ms
49,424 KB |
testcase_07 | AC | 42 ms
49,568 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 185 ms
56,448 KB |
testcase_16 | AC | 208 ms
56,384 KB |
testcase_17 | AC | 209 ms
55,924 KB |
testcase_18 | AC | 214 ms
56,628 KB |
testcase_19 | AC | 204 ms
56,000 KB |
testcase_20 | AC | 214 ms
56,444 KB |
testcase_21 | AC | 198 ms
55,816 KB |
testcase_22 | AC | 210 ms
56,720 KB |
testcase_23 | AC | 187 ms
56,448 KB |
testcase_24 | AC | 209 ms
56,188 KB |
testcase_25 | AC | 185 ms
55,884 KB |
testcase_26 | AC | 190 ms
56,240 KB |
testcase_27 | AC | 214 ms
56,520 KB |
testcase_28 | AC | 188 ms
55,748 KB |
testcase_29 | AC | 184 ms
55,608 KB |
testcase_30 | AC | 44 ms
49,656 KB |
testcase_31 | AC | 167 ms
56,668 KB |
testcase_32 | AC | 154 ms
56,684 KB |
testcase_33 | AC | 213 ms
58,060 KB |
testcase_34 | WA | - |
testcase_35 | AC | 43 ms
49,520 KB |
testcase_36 | AC | 43 ms
49,820 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { void submit() { int N = nextInt(); int X = nextInt(); int Y = nextInt(); int Z = nextInt(); int[] A = new int[N]; for(int i=0; i<N; i++){ A[i] = nextInt(); } String buy = "Yes"; for(int i=0; i<N; i++){ if(A[i]<1000){ if(X>0){ X--; }else if(Y>0){ Y--; }else if(Z>0){ Z--; }else{ buy = "No"; break; } } else if(A[i]<5000){ int tmp_X=A[i]/1000; if(A[i]%1000!=0){ tmp_X++; } if(X>=tmp_X){ X -= tmp_X; }else if(Y>0){ Y--; }else if(Z>0){ Z--; }else{ buy = "No"; break; } }else if(A[i]<10000){ if(X>0){ A[i]-=5000; X--; } int tmp_X=A[i]/1000; if(A[i]%1000!=0){ tmp_X++; } if(X>=tmp_X){ X -= tmp_X; }else if(Y>1){ Y-=2; }else if(Z>0){ Z--; }else{ buy = "No"; break; } }else{ int tmp_Z = A[i]/10000; if(Z>=tmp_Z){ Z -= tmp_Z; }else{ buy = "No"; break; } int amari_Z = A[i]%10000; if(Y>0 && amari_Z>=5000){ Y--; amari_Z -= 5000; } int tmp_X=amari_Z/1000; if(amari_Z%1000!=0){ tmp_X++; } if(X>=tmp_X){ X -= tmp_X; }else if(Y>0){ Y--; }else if(Z>0){ Z--; }else{ out.println("5 "+ A[i]); buy = "No"; break; } } } out.println(buy); } void preCalc() { } void stress() { } void test() { } Main() throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); preCalc(); submit(); //stress(); //test(); out.close(); } static final Random rng = new Random(); static int rand(int l, int r) { return l + rng.nextInt(r - l + 1); } public static void main(String[] args) throws IOException { new Main(); } BufferedReader br; PrintWriter out; StringTokenizer st; String nextToken() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return st.nextToken(); } String nextString() { try { return br.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } int nextInt() { return Integer.parseInt(nextToken()); } long nextLong() { return Long.parseLong(nextToken()); } double nextDouble() { return Double.parseDouble(nextToken()); } }