Submission #3807277
Source Code Expand
using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { var n = NextInt(); var k = NextInt(); var a = new int[n]; foreach (var i in Enumerable.Range(0, n)) { a[i] = NextInt(); } var ans = 0; var cnt = 0; foreach (var i in Enumerable.Range(0, k)) { cnt += a[i]; } foreach (var i in Enumerable.Range(0, n - k + 1)) { if (i != 0) { cnt += a[i + k - 1] - a[i - 1]; } ans += cnt; } WriteLine(ans); } static int NextInt() { return int.Parse(NextString()); } static string NextString() { var result = new List<char>(); while (true) { int next = Read(); if (next < 0) { break; } var nextChar = (char)next; if (!char.IsWhiteSpace(nextChar)) { result.Add(nextChar); } else if (nextChar != '\r') { break; } } return string.Join("", result); } }
Submission Info
Submission Time | |
---|---|
Task | C - 総和 |
User | ToshiroYanagi |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 1334 Byte |
Status | WA |
Exec Time | 211 ms |
Memory | 15568 KB |
Judge Result
Set Name | sample | subtask1 | subtask2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 50 | 0 / 50 | ||||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample01.txt, sample02.txt |
subtask1 | 00.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample01.txt, sample02.txt |
subtask2 | 00.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, sample01.txt, sample02.txt, sample01.txt, sample02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00.txt | AC | 25 ms | 11220 KB |
01.txt | AC | 25 ms | 11220 KB |
02.txt | AC | 25 ms | 11220 KB |
03.txt | WA | 26 ms | 11220 KB |
04.txt | WA | 27 ms | 11220 KB |
05.txt | WA | 27 ms | 11220 KB |
06.txt | WA | 27 ms | 13268 KB |
07.txt | WA | 26 ms | 11220 KB |
08.txt | WA | 26 ms | 11220 KB |
09.txt | WA | 27 ms | 11220 KB |
10.txt | WA | 27 ms | 13268 KB |
11.txt | WA | 194 ms | 15548 KB |
12.txt | WA | 200 ms | 13500 KB |
13.txt | WA | 211 ms | 15548 KB |
14.txt | WA | 199 ms | 15548 KB |
15.txt | WA | 199 ms | 15548 KB |
16.txt | WA | 200 ms | 13500 KB |
17.txt | WA | 205 ms | 15544 KB |
18.txt | AC | 79 ms | 15568 KB |
19.txt | WA | 211 ms | 15548 KB |
sample01.txt | AC | 25 ms | 11220 KB |
sample02.txt | WA | 25 ms | 11220 KB |