結果

問題 No.5 数字のブロック
ユーザー kanra661kanra661
提出日時 2014-12-16 16:26:42
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 72,108 KB
実行使用メモリ 60,732 KB
最終ジャッジ日時 2023-09-02 15:20:16
合計ジャッジ時間 10,235 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,592 KB
testcase_01 AC 127 ms
55,864 KB
testcase_02 WA -
testcase_03 AC 237 ms
59,556 KB
testcase_04 AC 218 ms
58,924 KB
testcase_05 WA -
testcase_06 AC 224 ms
59,356 KB
testcase_07 AC 213 ms
57,136 KB
testcase_08 AC 237 ms
60,620 KB
testcase_09 AC 197 ms
58,280 KB
testcase_10 AC 246 ms
60,120 KB
testcase_11 AC 221 ms
57,680 KB
testcase_12 AC 239 ms
59,520 KB
testcase_13 AC 246 ms
60,732 KB
testcase_14 AC 138 ms
55,580 KB
testcase_15 WA -
testcase_16 AC 249 ms
59,796 KB
testcase_17 AC 257 ms
60,216 KB
testcase_18 AC 259 ms
57,832 KB
testcase_19 AC 264 ms
60,480 KB
testcase_20 AC 126 ms
55,516 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 126 ms
55,776 KB
testcase_24 AC 153 ms
55,884 KB
testcase_25 AC 184 ms
55,972 KB
testcase_26 AC 125 ms
55,824 KB
testcase_27 AC 126 ms
55,548 KB
testcase_28 AC 133 ms
55,784 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 127 ms
55,620 KB
testcase_32 AC 126 ms
55,688 KB
testcase_33 AC 125 ms
56,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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