-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
71 lines (61 loc) · 1.07 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var (
N, W, K, V int
c, v [1000]int
answer [1000]int
)
func readVariables() {
N = nextInt()
W = nextInt()
K = nextInt()
V = nextInt()
for i := 0; i < N; i++ {
c[i], v[i] = nextInt(), nextInt()
}
}
func main() {
readVariables()
solve()
p()
}
func p() {
for _, v := range answer {
fmt.Println(v)
}
}
func solve() {
for i := 0; i < N; i++ {
answer[i] = (i + 1) % W
}
}
/* 以下、テンプレート*/
var scanner *bufio.Scanner
func init() {
scanner = bufio.NewScanner(os.Stdin)
scanner.Buffer(make([]byte, 0, 10000000), 10000000)
scanner.Split(bufio.ScanWords)
}
//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
if !scanner.Scan() {
panic("No more token.")
}
num, err := strconv.Atoi(scanner.Text())
if err != nil {
panic("nextInt(): cannot convert to int: " + scanner.Text())
}
return num
}
func nextStr() string {
if !scanner.Scan() {
panic("No more token.")
}
return scanner.Text()
}