結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2023-09-05 14:39:28 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 623 bytes |
コンパイル時間 | 4,417 ms |
コンパイル使用メモリ | 76,192 KB |
実行使用メモリ | 56,072 KB |
最終ジャッジ日時 | 2024-06-23 10:18:15 |
合計ジャッジ時間 | 11,850 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 RE * 10 |
ソースコード
import java.util.Scanner; import java.util.ArrayList; import java.util.List; import java.util.Collections; class Wandbox { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List<Integer> list = new ArrayList<>(); int l = sc.nextInt(); int n = sc.nextInt(); int cnt = 0; for (int i = 0; i < n; i++) { list.add(sc.nextInt()); } Collections.sort(list); for (int i = 0; l >= 0; i++) { l -= list.get(i); if (l >= 0) { cnt++; } } System.out.println(cnt); } }