結果

問題 No.5 数字のブロック
ユーザー ark723ark723
提出日時 2016-02-17 20:13:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 1,161 bytes
コンパイル時間 3,828 ms
コンパイル使用メモリ 72,568 KB
実行使用メモリ 53,140 KB
最終ジャッジ日時 2023-08-11 14:42:09
合計ジャッジ時間 6,655 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,564 KB
testcase_01 AC 43 ms
49,280 KB
testcase_02 AC 42 ms
49,352 KB
testcase_03 AC 84 ms
52,196 KB
testcase_04 AC 58 ms
51,492 KB
testcase_05 AC 78 ms
52,532 KB
testcase_06 AC 83 ms
52,064 KB
testcase_07 AC 64 ms
51,576 KB
testcase_08 AC 73 ms
52,244 KB
testcase_09 AC 56 ms
50,820 KB
testcase_10 AC 88 ms
52,536 KB
testcase_11 AC 63 ms
51,708 KB
testcase_12 AC 75 ms
53,140 KB
testcase_13 AC 80 ms
52,368 KB
testcase_14 AC 43 ms
49,428 KB
testcase_15 AC 44 ms
49,568 KB
testcase_16 AC 86 ms
53,088 KB
testcase_17 AC 88 ms
52,588 KB
testcase_18 AC 88 ms
52,996 KB
testcase_19 AC 94 ms
52,988 KB
testcase_20 AC 42 ms
49,424 KB
testcase_21 AC 43 ms
49,348 KB
testcase_22 AC 47 ms
49,428 KB
testcase_23 AC 43 ms
49,232 KB
testcase_24 AC 44 ms
49,452 KB
testcase_25 AC 47 ms
49,308 KB
testcase_26 AC 43 ms
47,524 KB
testcase_27 AC 44 ms
49,792 KB
testcase_28 AC 43 ms
49,380 KB
testcase_29 AC 62 ms
51,696 KB
testcase_30 AC 57 ms
50,688 KB
testcase_31 AC 43 ms
49,456 KB
testcase_32 AC 43 ms
49,312 KB
testcase_33 AC 43 ms
49,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package yukicoder001_100;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 *
 * @author yuya
 */
public class No005 {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line1 = br.readLine();
        String line2 = br.readLine();
        String line3 = br.readLine();
        int L = Integer.parseInt(line1);
        int N = Integer.parseInt(line2);
        
        String [] s = line3.split(" ",0);
        int n[] = new int[N];
        
        for(int i=0;i<s.length;i++){
            n[i]=Integer.parseInt(s[i]);
        }
        Arrays.sort(n);
        int ans=0;
        int b =0;
        for(int i=0;i<=n.length-1;i++){
            b+=n[i];
            if(b<=L){
                
                ans++;
            }else{
                break;
            }
        }
        System.out.println(ans);
    }
}
0