結果

問題 No.5 数字のブロック
ユーザー Mcpu3Mcpu3
提出日時 2018-09-05 16:55:55
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 411 bytes
コンパイル時間 2,184 ms
コンパイル使用メモリ 74,492 KB
実行使用メモリ 59,024 KB
最終ジャッジ日時 2024-04-27 14:35:07
合計ジャッジ時間 9,773 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
54,372 KB
testcase_01 AC 132 ms
54,244 KB
testcase_02 RE -
testcase_03 AC 248 ms
58,260 KB
testcase_04 AC 233 ms
57,364 KB
testcase_05 AC 263 ms
58,848 KB
testcase_06 AC 232 ms
58,092 KB
testcase_07 AC 227 ms
57,368 KB
testcase_08 AC 239 ms
58,272 KB
testcase_09 AC 205 ms
56,752 KB
testcase_10 AC 262 ms
58,572 KB
testcase_11 AC 230 ms
57,624 KB
testcase_12 AC 253 ms
58,300 KB
testcase_13 AC 259 ms
58,940 KB
testcase_14 AC 145 ms
54,240 KB
testcase_15 AC 164 ms
54,328 KB
testcase_16 AC 261 ms
58,500 KB
testcase_17 AC 269 ms
58,388 KB
testcase_18 AC 271 ms
59,024 KB
testcase_19 AC 267 ms
58,704 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 134 ms
54,328 KB
testcase_24 AC 161 ms
54,188 KB
testcase_25 AC 182 ms
54,220 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 222 ms
57,504 KB
testcase_30 AC 207 ms
56,536 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt(),n=sc.nextInt(),w[]=new int[n],s=0,t=0,i;
		for(i=0;i<n;++i) {
			w[i]=sc.nextInt();
			s+=w[i];
		}
		sc.close();
		Arrays.sort(w);
		for(i=0;;++i) {
			t+=w[i];
			if(t>l) break;
		}
		if(l>=s) i=n;
		System.out.print(i);
	}
}
0