結果
| 問題 |
No.8044 April Sum of Odd
|
| コンテスト | |
| ユーザー |
keymoon
|
| 提出日時 | 2021-01-01 19:49:03 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 1,009 bytes |
| コンパイル時間 | 2,905 ms |
| コンパイル使用メモリ | 108,864 KB |
| 実行使用メモリ | 32,816 KB |
| 最終ジャッジ日時 | 2024-10-11 12:11:08 |
| 合計ジャッジ時間 | 4,262 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using static System.Numerics.BigInteger;
public static class P
{
public static void Main()
{
var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
var n = nm[0];
var m = nm[1];
var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
int curStreak = 0;
long sum = 0;
for (int i = 0; i < n; i++)
{
if (a[i] % 2 == 1)
{
curStreak++;
sum += a[i];
}
else
{
if (m <= curStreak) Console.WriteLine(sum);
curStreak = 0;
sum = 0;
}
}
if (m <= curStreak) Console.WriteLine(sum);
}
}
keymoon