結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-27 16:41:08 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 5,000 ms |
| コード長 | 521 bytes |
| 記録 | |
| コンパイル時間 | 2,629 ms |
| コンパイル使用メモリ | 84,308 KB |
| 実行使用メモリ | 51,000 KB |
| 最終ジャッジ日時 | 2026-05-12 20:28:54 |
| 合計ジャッジ時間 | 7,710 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
import java.util.Arrays;
import java.util.Scanner;
public class No05 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int length = sc.nextInt();
int cntBlk = sc.nextInt();
int[] widthOfBlk = new int[cntBlk];
for(int i = 0; i < widthOfBlk.length; i++){
widthOfBlk[i] = sc.nextInt();
}
int cnt = 0;
Arrays.sort(widthOfBlk);
for(int w : widthOfBlk){
int tmp = length - w;
if(tmp >= 0){
length = tmp;
cnt++;
}
}
System.out.println(cnt);
}
}