結果
問題 | No.5 数字のブロック |
ユーザー | S1ho |
提出日時 | 2017-02-19 16:19:56 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 779 bytes |
コンパイル時間 | 3,263 ms |
コンパイル使用メモリ | 73,924 KB |
実行使用メモリ | 62,836 KB |
最終ジャッジ日時 | 2023-08-28 19:14:24 |
合計ジャッジ時間 | 10,790 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 127 ms
56,124 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 262 ms
60,532 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 154 ms
56,164 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 120 ms
55,808 KB |
testcase_21 | AC | 118 ms
55,888 KB |
testcase_22 | AC | 120 ms
55,724 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 120 ms
55,976 KB |
testcase_27 | AC | 120 ms
56,044 KB |
testcase_28 | AC | 119 ms
56,012 KB |
testcase_29 | AC | 218 ms
59,848 KB |
testcase_30 | AC | 197 ms
58,940 KB |
testcase_31 | AC | 120 ms
56,540 KB |
testcase_32 | AC | 118 ms
55,872 KB |
testcase_33 | AC | 118 ms
55,740 KB |
ソースコード
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Box { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int l = scanner.nextInt(); int n = scanner.nextInt(); ArrayList<Integer> width = new ArrayList(); for(int i=0;i<n;i++){ width.add(scanner.nextInt()); } Collections.sort(width); int sum = 0; int count = 0; for(int i=0;i<width.size();i++){ sum += width.get(i); count++; if(sum >= l) break; } System.out.println(count); } }