結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
cotcotton
|
| 提出日時 | 2018-10-30 06:09:10 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 2,162 ms |
| コンパイル使用メモリ | 85,356 KB |
| 実行使用メモリ | 47,424 KB |
| 最終ジャッジ日時 | 2026-05-13 17:58:43 |
| 合計ジャッジ時間 | 5,083 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 34 |
ソースコード
import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] arr = Arrays.stream(sc.nextLine().split(" "))
.mapToInt(Integer::parseInt)
.toArray();
Arrays.sort(arr);
int i = 0;
int j = 0;
for(i = 0; m > 0; i++) {
j += arr[i];
if(j > n) {
break;
}
m--;
}
System.out.println(i);
}
}
cotcotton