結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
mos_13184925
|
| 提出日時 | 2018-06-18 14:15:27 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 588 bytes |
| コンパイル時間 | 2,165 ms |
| コンパイル使用メモリ | 78,596 KB |
| 実行使用メモリ | 58,892 KB |
| 最終ジャッジ日時 | 2024-06-30 16:53:31 |
| 合計ジャッジ時間 | 9,726 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 RE * 7 |
ソースコード
import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String[]args) {
Scanner sc = new Scanner(System.in);
int L = sc.nextInt();
int N = sc.nextInt();
int[] W = new int[N];
for(int i = 0; i < N; i++) {
W[i] = sc.nextInt();
}
Arrays.sort(W);
int ans = 0;
int n = 0;
for(int i = 0; n < L; i++) {
n += W[i];
if(n > L) {
break;
};
ans ++;
}
System.out.println(ans);
}
}
mos_13184925