結果

問題 No.5 数字のブロック
ユーザー HEGO55HEGO55
提出日時 2017-05-09 21:39:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 274 ms / 5,000 ms
コード長 474 bytes
コンパイル時間 2,992 ms
コンパイル使用メモリ 71,296 KB
実行使用メモリ 60,600 KB
最終ジャッジ日時 2023-08-11 17:19:20
合計ジャッジ時間 10,421 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,472 KB
testcase_01 AC 133 ms
55,656 KB
testcase_02 AC 130 ms
55,628 KB
testcase_03 AC 238 ms
60,088 KB
testcase_04 AC 211 ms
58,968 KB
testcase_05 AC 253 ms
60,192 KB
testcase_06 AC 221 ms
59,680 KB
testcase_07 AC 215 ms
59,284 KB
testcase_08 AC 239 ms
59,628 KB
testcase_09 AC 197 ms
58,480 KB
testcase_10 AC 249 ms
59,832 KB
testcase_11 AC 234 ms
60,080 KB
testcase_12 AC 251 ms
60,252 KB
testcase_13 AC 253 ms
59,992 KB
testcase_14 AC 145 ms
53,988 KB
testcase_15 AC 159 ms
55,836 KB
testcase_16 AC 252 ms
60,364 KB
testcase_17 AC 274 ms
60,600 KB
testcase_18 AC 269 ms
60,412 KB
testcase_19 AC 273 ms
59,748 KB
testcase_20 AC 133 ms
55,796 KB
testcase_21 AC 134 ms
55,568 KB
testcase_22 AC 134 ms
55,632 KB
testcase_23 AC 134 ms
55,612 KB
testcase_24 AC 162 ms
55,836 KB
testcase_25 AC 199 ms
55,820 KB
testcase_26 AC 134 ms
55,804 KB
testcase_27 AC 132 ms
55,840 KB
testcase_28 AC 132 ms
55,592 KB
testcase_29 AC 216 ms
58,932 KB
testcase_30 AC 207 ms
58,260 KB
testcase_31 AC 133 ms
55,924 KB
testcase_32 AC 130 ms
55,732 KB
testcase_33 AC 130 ms
55,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Test27{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(); //16
		int W = sc.nextInt(); //3
		int[] num = new int[W]; //0,1,2
		int count = 0;
		
		for(int i=0; i<W; i++){ //i=0,1,2
			num[i] = sc.nextInt(); //num[0]=10 num[1]=5 num[2]=7
		}
		
	    Arrays.sort(num);
				
		for(int m=0; m<num.length; m++){
			N -= num[m];
			if(N>=0){
				count++;
			}
		}
		
		System.out.println(count);
	}
}
0