結果

問題 No.5 数字のブロック
ユーザー yun_appyun_app
提出日時 2016-05-09 12:17:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 113 ms / 5,000 ms
コード長 926 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 76,172 KB
実行使用メモリ 40,608 KB
最終ジャッジ日時 2024-04-29 07:14:18
合計ジャッジ時間 5,451 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
36,588 KB
testcase_01 AC 51 ms
37,132 KB
testcase_02 AC 49 ms
37,040 KB
testcase_03 AC 84 ms
39,816 KB
testcase_04 AC 83 ms
38,524 KB
testcase_05 AC 109 ms
39,540 KB
testcase_06 AC 84 ms
38,376 KB
testcase_07 AC 78 ms
38,840 KB
testcase_08 AC 84 ms
38,872 KB
testcase_09 AC 74 ms
38,116 KB
testcase_10 AC 110 ms
40,176 KB
testcase_11 AC 81 ms
38,172 KB
testcase_12 AC 85 ms
38,924 KB
testcase_13 AC 96 ms
39,892 KB
testcase_14 AC 53 ms
37,004 KB
testcase_15 AC 54 ms
37,112 KB
testcase_16 AC 101 ms
39,288 KB
testcase_17 AC 113 ms
40,608 KB
testcase_18 AC 106 ms
40,292 KB
testcase_19 AC 111 ms
40,188 KB
testcase_20 AC 50 ms
37,048 KB
testcase_21 AC 52 ms
37,124 KB
testcase_22 AC 51 ms
36,840 KB
testcase_23 AC 50 ms
37,176 KB
testcase_24 AC 54 ms
37,096 KB
testcase_25 AC 57 ms
37,224 KB
testcase_26 AC 50 ms
36,840 KB
testcase_27 AC 48 ms
37,068 KB
testcase_28 AC 49 ms
36,952 KB
testcase_29 AC 86 ms
38,856 KB
testcase_30 AC 68 ms
38,532 KB
testcase_31 AC 55 ms
36,588 KB
testcase_32 AC 50 ms
37,048 KB
testcase_33 AC 51 ms
37,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int max = Integer.parseInt(br.readLine());
        int N   = Integer.parseInt(br.readLine());
        String[] lines = br.readLine().split(" ");
        ArrayList<Integer> list = new ArrayList<Integer>();
        for(String st:lines){
            list.add(Integer.parseInt(st));
        }
        Collections.sort(list);
        int ans = 0;
        for(int i:list){
            max -= i;
            if(max>=0){
                ans++;
            }else{
                break;
            }
        }
        System.out.println(ans);
    }
}
0