結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2015-05-01 18:00:37 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 372 bytes |
コンパイル時間 | 1,986 ms |
コンパイル使用メモリ | 74,472 KB |
実行使用メモリ | 59,092 KB |
最終ジャッジ日時 | 2024-07-05 17:23:47 |
合計ジャッジ時間 | 9,370 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 RE * 10 |
ソースコード
import java.util.*; class Yukico5 { public static void main(String[] args){ Scanner stdin = new Scanner(System.in); int l = stdin.nextInt(); int n = stdin.nextInt(); int[] w = new int[n]; for(int i=0; i<n; i++) { w[i] = stdin.nextInt(); } Arrays.sort(w); int a=0; int i=0; while(a<=l) { a = a+w[i]; i++; } System.out.println(i-1); } }