結果

問題 No.5 数字のブロック
ユーザー kazapyon27kazapyon27
提出日時 2017-05-07 17:21:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 262 ms / 5,000 ms
コード長 646 bytes
コンパイル時間 3,940 ms
コンパイル使用メモリ 72,696 KB
実行使用メモリ 60,012 KB
最終ジャッジ日時 2023-08-11 17:18:46
合計ジャッジ時間 11,887 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,816 KB
testcase_01 AC 131 ms
56,188 KB
testcase_02 AC 130 ms
55,760 KB
testcase_03 AC 234 ms
58,928 KB
testcase_04 AC 218 ms
59,304 KB
testcase_05 AC 248 ms
59,316 KB
testcase_06 AC 229 ms
59,628 KB
testcase_07 AC 210 ms
59,316 KB
testcase_08 AC 223 ms
59,212 KB
testcase_09 AC 210 ms
58,696 KB
testcase_10 AC 253 ms
60,012 KB
testcase_11 AC 223 ms
58,924 KB
testcase_12 AC 238 ms
59,324 KB
testcase_13 AC 247 ms
59,312 KB
testcase_14 AC 143 ms
56,088 KB
testcase_15 AC 160 ms
55,984 KB
testcase_16 AC 247 ms
59,608 KB
testcase_17 AC 256 ms
59,840 KB
testcase_18 AC 253 ms
59,648 KB
testcase_19 AC 262 ms
59,920 KB
testcase_20 AC 130 ms
55,712 KB
testcase_21 AC 130 ms
55,784 KB
testcase_22 AC 130 ms
55,892 KB
testcase_23 AC 132 ms
56,040 KB
testcase_24 AC 158 ms
55,960 KB
testcase_25 AC 192 ms
56,532 KB
testcase_26 AC 130 ms
55,788 KB
testcase_27 AC 131 ms
55,868 KB
testcase_28 AC 131 ms
55,944 KB
testcase_29 AC 223 ms
59,172 KB
testcase_30 AC 211 ms
59,444 KB
testcase_31 AC 130 ms
55,772 KB
testcase_32 AC 130 ms
55,752 KB
testcase_33 AC 131 ms
55,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*No.5 数字のブロック*/
import java.util.*;
public class No5 {
	public static void main(String[] args) {
		short box_width,block_quantity,count;		
		try(Scanner input = new Scanner(System.in)){
			box_width=input.nextShort();
			block_quantity=input.nextShort();
			short block_width[]= new short[block_quantity];
			for(int i=0;i<block_quantity;i++){
				block_width[i]=input.nextShort();
			}
			Arrays.sort(block_width);
			for(count=1;count<=block_quantity;count++){
				box_width-=block_width[count-1];
				if(box_width<0){
					break;
				}
			}
			System.out.println(count-1);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
0