Submission #3807064
Source Code Expand
package main import ( "bufio" "fmt" "io" "os" "strconv" ) var nextString func() string func init() { nextString = newReadString(os.Stdin) } func main() { n := nextInt() k := nextInt() a := make([]int, n) for i := range a { a[i] = nextInt() } var ans, cnt int for i := 0; i < k; i++ { cnt += a[i] } for i := 0; i < n-k+1; i++ { if i != 0 { cnt += a[i+k-1] - a[i-1] } ans += cnt } fmt.Println(ans) } func nextInt() (result int) { result, _ = strconv.Atoi(nextString()) return } func newReadString(ior io.Reader) func() string { r := bufio.NewScanner(ior) r.Buffer(make([]byte, 1024), int(1e+11)) r.Split(bufio.ScanWords) return func() string { if !r.Scan() { } return r.Text() } }
Submission Info
Submission Time | |
---|---|
Task | C - 総和 |
User | ToshiroYanagi |
Language | Go (1.6) |
Score | 100 |
Code Size | 785 Byte |
Status | AC |
Exec Time | 26 ms |
Memory | 2560 KB |
Judge Result
Set Name | sample | subtask1 | subtask2 | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 50 / 50 | 50 / 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 | 1 ms | 640 KB |
01.txt | AC | 1 ms | 640 KB |
02.txt | AC | 1 ms | 640 KB |
03.txt | AC | 2 ms | 640 KB |
04.txt | AC | 2 ms | 640 KB |
05.txt | AC | 1 ms | 640 KB |
06.txt | AC | 2 ms | 640 KB |
07.txt | AC | 1 ms | 640 KB |
08.txt | AC | 1 ms | 640 KB |
09.txt | AC | 1 ms | 640 KB |
10.txt | AC | 2 ms | 640 KB |
11.txt | AC | 25 ms | 2176 KB |
12.txt | AC | 25 ms | 2176 KB |
13.txt | AC | 25 ms | 2176 KB |
14.txt | AC | 25 ms | 2176 KB |
15.txt | AC | 24 ms | 2176 KB |
16.txt | AC | 25 ms | 2176 KB |
17.txt | AC | 26 ms | 2560 KB |
18.txt | AC | 13 ms | 1536 KB |
19.txt | AC | 25 ms | 2176 KB |
sample01.txt | AC | 1 ms | 640 KB |
sample02.txt | AC | 1 ms | 640 KB |