結果

問題 No.5 数字のブロック
ユーザー kazapyon27kazapyon27
提出日時 2017-05-07 17:21:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 257 ms / 5,000 ms
コード長 646 bytes
コンパイル時間 3,353 ms
コンパイル使用メモリ 79,368 KB
実行使用メモリ 47,308 KB
最終ジャッジ日時 2024-04-29 08:57:53
合計ジャッジ時間 10,996 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,620 KB
testcase_01 AC 132 ms
41,612 KB
testcase_02 AC 132 ms
41,280 KB
testcase_03 AC 236 ms
45,560 KB
testcase_04 AC 223 ms
45,356 KB
testcase_05 AC 248 ms
46,292 KB
testcase_06 AC 227 ms
45,752 KB
testcase_07 AC 209 ms
45,764 KB
testcase_08 AC 237 ms
45,760 KB
testcase_09 AC 202 ms
44,064 KB
testcase_10 AC 246 ms
46,868 KB
testcase_11 AC 207 ms
45,372 KB
testcase_12 AC 237 ms
46,016 KB
testcase_13 AC 243 ms
45,464 KB
testcase_14 AC 143 ms
41,588 KB
testcase_15 AC 165 ms
41,520 KB
testcase_16 AC 251 ms
46,748 KB
testcase_17 AC 256 ms
47,084 KB
testcase_18 AC 256 ms
47,308 KB
testcase_19 AC 257 ms
46,312 KB
testcase_20 AC 118 ms
40,412 KB
testcase_21 AC 130 ms
41,116 KB
testcase_22 AC 133 ms
41,156 KB
testcase_23 AC 118 ms
41,320 KB
testcase_24 AC 160 ms
41,700 KB
testcase_25 AC 179 ms
42,128 KB
testcase_26 AC 118 ms
40,108 KB
testcase_27 AC 116 ms
39,964 KB
testcase_28 AC 134 ms
41,364 KB
testcase_29 AC 223 ms
46,272 KB
testcase_30 AC 205 ms
44,464 KB
testcase_31 AC 128 ms
41,256 KB
testcase_32 AC 130 ms
41,412 KB
testcase_33 AC 129 ms
41,144 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