結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
ちよちゃん
|
| 提出日時 | 2016-05-10 10:40:59 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 702 bytes |
| コンパイル時間 | 3,269 ms |
| コンパイル使用メモリ | 74,556 KB |
| 実行使用メモリ | 58,692 KB |
| 最終ジャッジ日時 | 2024-10-05 13:27:06 |
| 合計ジャッジ時間 | 10,681 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 WA * 7 |
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class Yuki1 {
public static void main(String[] argas) {
Scanner scan = new Scanner(System.in);
// 箱の幅
int box = scan.nextInt();
// ブロックの数
int blockCount = scan.nextInt();
int[] blockWidth = new int [blockCount];
for (int i = 0; i < blockWidth.length; i++) {
blockWidth[i] = scan.nextInt();
}
Arrays.sort(blockWidth);
int boxWidthAll = 0;
int boxWidthAllCount = 0;
while(box>boxWidthAll && blockCount>boxWidthAllCount){
boxWidthAll +=blockWidth[boxWidthAllCount];
if(box>boxWidthAll) {
boxWidthAllCount++;
}
}
System.out.println(boxWidthAllCount);
}
}
ちよちゃん