結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,624 KB
testcase_01 AC 56 ms
53,620 KB
testcase_02 WA -
testcase_03 AC 104 ms
55,980 KB
testcase_04 AC 81 ms
54,628 KB
testcase_05 WA -
testcase_06 AC 95 ms
54,780 KB
testcase_07 AC 83 ms
54,492 KB
testcase_08 AC 92 ms
55,476 KB
testcase_09 AC 69 ms
54,756 KB
testcase_10 AC 107 ms
55,944 KB
testcase_11 AC 81 ms
54,572 KB
testcase_12 AC 93 ms
55,896 KB
testcase_13 AC 109 ms
55,968 KB
testcase_14 AC 55 ms
52,612 KB
testcase_15 WA -
testcase_16 AC 112 ms
55,808 KB
testcase_17 AC 112 ms
55,644 KB
testcase_18 AC 111 ms
55,908 KB
testcase_19 AC 111 ms
55,688 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 56 ms
53,640 KB
testcase_24 AC 58 ms
53,656 KB
testcase_25 AC 62 ms
53,656 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

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