結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
hj5ln8kbDM8t2fF
|
| 提出日時 | 2019-06-16 15:40:40 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,062 bytes |
| コンパイル時間 | 2,141 ms |
| コンパイル使用メモリ | 81,176 KB |
| 実行使用メモリ | 55,900 KB |
| 最終ジャッジ日時 | 2024-11-24 03:53:32 |
| 合計ジャッジ時間 | 9,824 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 10 |
ソースコード
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc1 = new Scanner(System.in);
// Scanner sc2 = new Scanner(System.in);
// Scanner sc3 = new Scanner(System.in);
List <Integer> W = new ArrayList<Integer>();
//大きな箱の幅
int L = sc1.nextInt();
//ブロックの数
// int N = sc2.nextInt();
int N = sc1.nextInt();
//各ブロックの幅を格納
for(int i=0;i<N;i++ ){
// int input = sc3.nextInt();
int input = sc1.nextInt();
W.add(input);
}
//昇順でsort
Collections.sort(W);
//大きな箱の中に、小さい箱を入れていく
int total = 0;
int kosu = 0;
for(int j=0;j<N;j++){
int num = W.get(j);
total = total + num;
kosu = j;
if(total > L){
break;
}
}
System.out.println(kosu);
}
}
hj5ln8kbDM8t2fF