結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-11-10 09:47:11 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 160 ms / 5,000 ms |
| + 264µs | |
| コード長 | 519 bytes |
| 記録 | |
| コンパイル時間 | 1,412 ms |
| コンパイル使用メモリ | 84,376 KB |
| 実行使用メモリ | 50,316 KB |
| 最終ジャッジ日時 | 2026-08-23 10:46:20 |
| 合計ジャッジ時間 | 6,929 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int length = sc.nextInt();
int n = sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
int count = 0;
while (count < n && arr[count] <= length) {
length -= arr[count];
count++;
}
System.out.println(count);
}
}
tenten