結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
hhgfhn1
|
| 提出日時 | 2018-08-20 23:29:02 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 2,150 ms |
| コンパイル使用メモリ | 76,300 KB |
| 実行使用メモリ | 47,464 KB |
| 最終ジャッジ日時 | 2024-11-27 18:51:49 |
| 合計ジャッジ時間 | 9,049 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 34 |
ソースコード
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
class sampleA {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int l = scan.nextInt();
int n = scan.nextInt();
List<Integer> blocksLength = new ArrayList<>();
int sumW = 0;
for (int i = 0; i <= n; i++) {
blocksLength.add(scan.nextInt());
}
scan.close();
Collections.sort(blocksLength);
for (int i = 0; i <= n; i++) {
if (sumW + blocksLength.get(i) <= l) {
sumW += blocksLength.get(i);
} else {
System.out.print(i);
break;
}
}
}
}
hhgfhn1