結果

問題 No.5 数字のブロック
ユーザー kuramubonnkuramubonn
提出日時 2023-02-01 21:22:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 83,312 KB
実行使用メモリ 60,980 KB
最終ジャッジ日時 2023-09-14 07:11:56
合計ジャッジ時間 9,974 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,560 KB
testcase_01 AC 120 ms
55,464 KB
testcase_02 WA -
testcase_03 AC 236 ms
59,696 KB
testcase_04 AC 215 ms
59,120 KB
testcase_05 WA -
testcase_06 AC 232 ms
58,856 KB
testcase_07 AC 213 ms
59,728 KB
testcase_08 AC 233 ms
58,964 KB
testcase_09 AC 198 ms
58,516 KB
testcase_10 AC 263 ms
60,980 KB
testcase_11 AC 220 ms
59,484 KB
testcase_12 AC 242 ms
60,252 KB
testcase_13 AC 253 ms
60,344 KB
testcase_14 AC 138 ms
56,180 KB
testcase_15 WA -
testcase_16 AC 251 ms
58,196 KB
testcase_17 AC 266 ms
60,680 KB
testcase_18 AC 261 ms
60,392 KB
testcase_19 AC 269 ms
60,816 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 120 ms
55,464 KB
testcase_24 AC 156 ms
56,152 KB
testcase_25 AC 166 ms
54,952 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int haba = sc.nextInt(),num = sc.nextInt();
		ArrayList <Integer> list = new ArrayList<Integer>();
		
		for(int i = 0 ; i < num ; i++)list.add(sc.nextInt());
		Collections.sort(list);
		int count = 0 , kosu = 0;
		
		while(count < haba) {
			count += list.get(kosu);
			kosu++;
		}
		
		System.out.println(kosu - 1);
		
	}
}
0