結果
問題 | No.5 数字のブロック |
ユーザー |
|
提出日時 | 2023-02-01 21:22:36 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 503 bytes |
コンパイル時間 | 2,182 ms |
コンパイル使用メモリ | 75,888 KB |
実行使用メモリ | 58,728 KB |
最終ジャッジ日時 | 2024-07-01 14:38:37 |
合計ジャッジ時間 | 10,042 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 7 RE * 7 |
ソースコード
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int haba = sc.nextInt(),num = sc.nextInt(); ArrayList <Integer> list = new ArrayList<Integer>(); for(int i = 0 ; i < num ; i++)list.add(sc.nextInt()); Collections.sort(list); int count = 0 , kosu = 0; while(count < haba) { count += list.get(kosu); kosu++; } System.out.println(kosu - 1); } }