結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-19 16:11:44 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 695 bytes |
| 記録 | |
| コンパイル時間 | 2,729 ms |
| コンパイル使用メモリ | 84,212 KB |
| 実行使用メモリ | 51,280 KB |
| 最終ジャッジ日時 | 2026-06-03 21:29:03 |
| 合計ジャッジ時間 | 7,938 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 RE * 10 |
ソースコード
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;
while(sum <= l){
sum += width.get(count);
count++;
}
System.out.println(count-1);
}
}