結果

問題 No.156 キャンディー・ボックス
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-10 14:17:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 2,171 ms
コンパイル使用メモリ 73,808 KB
実行使用メモリ 41,476 KB
最終ジャッジ日時 2024-04-21 11:33:45
合計ジャッジ時間 6,819 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
39,868 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 111 ms
41,028 KB
testcase_04 AC 104 ms
39,980 KB
testcase_05 AC 103 ms
40,228 KB
testcase_06 AC 114 ms
40,960 KB
testcase_07 AC 112 ms
41,300 KB
testcase_08 AC 107 ms
40,676 KB
testcase_09 AC 103 ms
40,020 KB
testcase_10 AC 102 ms
40,012 KB
testcase_11 AC 101 ms
40,184 KB
testcase_12 AC 109 ms
40,892 KB
testcase_13 AC 112 ms
41,176 KB
testcase_14 AC 106 ms
40,016 KB
testcase_15 AC 109 ms
41,216 KB
testcase_16 AC 117 ms
41,156 KB
testcase_17 AC 101 ms
39,880 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 113 ms
41,476 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 110 ms
41,192 KB
testcase_26 AC 100 ms
39,896 KB
testcase_27 AC 101 ms
40,096 KB
testcase_28 AC 98 ms
39,952 KB
testcase_29 WA -
testcase_30 AC 103 ms
40,144 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 111 ms
41,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int m = sc.nextInt();
		long[] ar = new long[n];
		int num = 0;
		for (int i=0; i<n; i++) {
			if (i==0) {ar[0] = sc.nextInt();}
			else {
				ar[i] = sc.nextInt() + ar[i-1];
			}
			if (ar[i]>=m) {num = i+1; break;}
		}
		System.out.println(num);
	}
}
0