結果

問題 No.156 キャンディー・ボックス
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-10 14:22:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 2,589 ms
コンパイル使用メモリ 73,928 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-04-21 11:50:59
合計ジャッジ時間 7,449 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 122 ms
40,032 KB
testcase_03 AC 131 ms
41,108 KB
testcase_04 AC 130 ms
41,248 KB
testcase_05 WA -
testcase_06 AC 121 ms
41,264 KB
testcase_07 AC 110 ms
39,972 KB
testcase_08 AC 113 ms
40,240 KB
testcase_09 AC 122 ms
41,364 KB
testcase_10 AC 117 ms
40,144 KB
testcase_11 AC 111 ms
40,256 KB
testcase_12 AC 115 ms
40,016 KB
testcase_13 AC 131 ms
41,176 KB
testcase_14 AC 125 ms
40,708 KB
testcase_15 AC 119 ms
40,208 KB
testcase_16 AC 117 ms
40,364 KB
testcase_17 AC 129 ms
41,440 KB
testcase_18 WA -
testcase_19 AC 114 ms
39,960 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 118 ms
39,952 KB
testcase_24 AC 113 ms
40,092 KB
testcase_25 AC 123 ms
41,128 KB
testcase_26 AC 134 ms
41,224 KB
testcase_27 AC 129 ms
41,504 KB
testcase_28 WA -
testcase_29 AC 121 ms
41,120 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 116 ms
40,340 KB
testcase_33 AC 123 ms
41,104 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++;}
		}
		System.out.println(num);
	}
}
0