結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
cotcotton
|
| 提出日時 | 2018-10-30 06:09:10 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 464 bytes |
| コンパイル時間 | 1,983 ms |
| コンパイル使用メモリ | 82,972 KB |
| 実行使用メモリ | 41,852 KB |
| 最終ジャッジ日時 | 2024-11-19 10:29:34 |
| 合計ジャッジ時間 | 6,985 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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