結果

問題 No.5 数字のブロック
ユーザー marumaru
提出日時 2016-03-20 02:49:03
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 875 bytes
コンパイル時間 3,881 ms
コンパイル使用メモリ 77,660 KB
実行使用メモリ 58,732 KB
最終ジャッジ日時 2024-04-08 17:14:34
合計ジャッジ時間 13,138 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,808 KB
testcase_01 AC 136 ms
58,064 KB
testcase_02 WA -
testcase_03 AC 337 ms
58,660 KB
testcase_04 AC 244 ms
58,088 KB
testcase_05 WA -
testcase_06 AC 300 ms
56,768 KB
testcase_07 AC 267 ms
58,588 KB
testcase_08 AC 316 ms
58,596 KB
testcase_09 AC 187 ms
57,724 KB
testcase_10 AC 469 ms
58,692 KB
testcase_11 AC 256 ms
58,468 KB
testcase_12 AC 350 ms
58,616 KB
testcase_13 AC 356 ms
58,684 KB
testcase_14 AC 131 ms
57,840 KB
testcase_15 WA -
testcase_16 AC 393 ms
58,732 KB
testcase_17 AC 470 ms
58,676 KB
testcase_18 AC 494 ms
58,692 KB
testcase_19 AC 577 ms
58,716 KB
testcase_20 RE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 129 ms
57,600 KB
testcase_24 AC 145 ms
57,956 KB
testcase_25 AC 155 ms
57,848 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.Scanner;

public class yukicoder_5 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		String str_l = scanner.nextLine();
		int l = Integer.parseInt(str_l);
		
		String str_n = scanner.nextLine();
		int n = Integer.parseInt(str_n);
		
		String w = scanner.nextLine();
		
		String[] array = w.split(" ");
		int[] array2 = new int[array.length];
		
		for (int i = 0; i < array.length; i++) {
			array2[i] = Integer.parseInt(array[i]);
		}
		
		for (int j = 0; j < array2.length; j++) {
			for (int i = 0; i < array2.length - 1; i++) {
				if (array2[i] > array2[i+1]) {
					int t;
					t = array2[i];
					array2[i] = array2[i+1];
					array2[i+1] = t;
				}
			}
		}
		
		int block = 0;
		
		int sum = 0;
		
		for (block = 0; sum < l; block++) {
			sum += array2[block];
		}
		
		System.out.println(block - 1);
	}
}
	
0