結果
問題 | No.1015 おつりは要らないです |
ユーザー | cnt_fo |
提出日時 | 2020-04-03 22:42:48 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,559 bytes |
コンパイル時間 | 2,235 ms |
コンパイル使用メモリ | 74,712 KB |
実行使用メモリ | 58,256 KB |
最終ジャッジ日時 | 2023-09-16 03:44:27 |
合計ジャッジ時間 | 9,155 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 44 ms
49,472 KB |
testcase_02 | AC | 44 ms
49,504 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 44 ms
49,468 KB |
testcase_07 | AC | 45 ms
49,472 KB |
testcase_08 | AC | 43 ms
49,528 KB |
testcase_09 | AC | 45 ms
49,564 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 207 ms
55,844 KB |
testcase_16 | AC | 221 ms
56,080 KB |
testcase_17 | AC | 218 ms
56,280 KB |
testcase_18 | AC | 213 ms
56,228 KB |
testcase_19 | AC | 198 ms
56,000 KB |
testcase_20 | AC | 191 ms
55,928 KB |
testcase_21 | AC | 215 ms
56,312 KB |
testcase_22 | AC | 217 ms
55,956 KB |
testcase_23 | AC | 194 ms
56,496 KB |
testcase_24 | AC | 217 ms
56,472 KB |
testcase_25 | AC | 189 ms
55,664 KB |
testcase_26 | AC | 192 ms
55,588 KB |
testcase_27 | AC | 196 ms
56,136 KB |
testcase_28 | AC | 208 ms
55,868 KB |
testcase_29 | AC | 209 ms
56,132 KB |
testcase_30 | AC | 46 ms
49,380 KB |
testcase_31 | AC | 170 ms
56,312 KB |
testcase_32 | AC | 161 ms
56,356 KB |
testcase_33 | AC | 211 ms
58,104 KB |
testcase_34 | AC | 45 ms
49,512 KB |
testcase_35 | WA | - |
testcase_36 | AC | 44 ms
50,092 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{ 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()); } }