結果

問題 No.5 数字のブロック
ユーザー ark723ark723
提出日時 2016-02-17 20:08:57
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,148 bytes
コンパイル時間 3,565 ms
コンパイル使用メモリ 75,452 KB
実行使用メモリ 56,232 KB
最終ジャッジ日時 2023-10-22 06:16:36
合計ジャッジ時間 7,261 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
53,644 KB
testcase_01 AC 57 ms
53,648 KB
testcase_02 RE -
testcase_03 AC 94 ms
55,872 KB
testcase_04 AC 82 ms
54,492 KB
testcase_05 AC 105 ms
56,232 KB
testcase_06 AC 90 ms
55,096 KB
testcase_07 AC 84 ms
54,528 KB
testcase_08 AC 91 ms
55,940 KB
testcase_09 AC 66 ms
54,772 KB
testcase_10 AC 105 ms
55,476 KB
testcase_11 AC 82 ms
54,772 KB
testcase_12 AC 92 ms
56,012 KB
testcase_13 AC 99 ms
54,116 KB
testcase_14 AC 56 ms
51,592 KB
testcase_15 AC 59 ms
52,648 KB
testcase_16 AC 97 ms
55,236 KB
testcase_17 AC 104 ms
56,132 KB
testcase_18 AC 99 ms
53,332 KB
testcase_19 AC 104 ms
56,036 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 57 ms
53,644 KB
testcase_24 AC 56 ms
53,660 KB
testcase_25 AC 57 ms
52,620 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 87 ms
54,496 KB
testcase_30 AC 66 ms
54,524 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

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;i++){
            if(b<=L){
                b+=n[i];
                ans++;
            }else{
                break;
            }
        }
        System.out.println(ans-1);
    }
}
0