結果

問題 No.3044 April Sum of Odd
ユーザー ウップス600ウップス600
提出日時 2022-01-12 21:20:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 835 bytes
コンパイル時間 3,789 ms
コンパイル使用メモリ 76,892 KB
実行使用メモリ 59,344 KB
最終ジャッジ日時 2024-04-27 11:43:34
合計ジャッジ時間 7,094 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
54,088 KB
testcase_01 AC 134 ms
54,396 KB
testcase_02 AC 134 ms
53,972 KB
testcase_03 AC 257 ms
58,052 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 633 ms
59,344 KB
testcase_11 AC 553 ms
59,180 KB
testcase_12 AC 131 ms
53,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java. util. Scanner;

public class Main{
	public static void main (String[] args){
		Scanner scanner = new Scanner (System. in);
		int[] number = new int[2];
		
		for (int j = 0; j < number. length; j ++){
			number[j] = scanner. nextInt();
		}
		
		long[] point = new long[number[0]];
		
		for (int j = 0; j < number[0]; j ++){
			point[j] = scanner. nextLong();
		}
		int answer = 0;
		long x = 0;
		for (int j = 0; j <= number[0] - number[1]; j ++){
			for (int k = 0; k < number[1]; k ++){
				if (point[j + k] % 2 == 0){
					answer = 1;
				}
			}
			if (answer == 1){
				if (x != 0){
					System. out. println (x);
				}
				answer = 0;
				x = 0;
				continue;
			}
			for (int k = 0; k < number[1]; k ++){
				x += point[j + k];
					
			}
		}
		if (x != 0){
			System. out. println (x);
		}
		scanner. close();
	}		
}
0