結果
| 問題 | 
                            No.156 キャンディー・ボックス
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Tsukasa_Type
                         | 
                    
| 提出日時 | 2018-02-10 14:21:39 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 427 bytes | 
| コンパイル時間 | 2,173 ms | 
| コンパイル使用メモリ | 74,756 KB | 
| 実行使用メモリ | 55,844 KB | 
| 最終ジャッジ日時 | 2024-10-13 10:17:53 | 
| 合計ジャッジ時間 | 8,057 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 4 | 
| other | WA * 30 | 
ソースコード
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];
			}
			System.out.println(ar[i]);
			if (ar[i] <= m) {num++;}
		}
		System.out.println(num);
	}
}
            
            
            
        
            
Tsukasa_Type