-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy path10963.go
More file actions
42 lines (37 loc) · 713 Bytes
/
10963.go
File metadata and controls
42 lines (37 loc) · 713 Bytes
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
// UVa 10963 - The Swallowing Ground
package main
import (
"fmt"
"os"
)
func solve(w int, gaps [][2]int) bool {
diff := gaps[0][0] - gaps[0][1]
for i := 2; i < w; i++ {
if diff != gaps[i][0]-gaps[i][1] {
return false
}
}
return true
}
func main() {
in, _ := os.Open("10963.in")
defer in.Close()
out, _ := os.Create("10963.out")
defer out.Close()
var kase, w int
for fmt.Fscanf(in, "%d", &kase); kase > 0; kase-- {
fmt.Fscanf(in, "\n%d", &w)
gaps := make([][2]int, w)
for i := range gaps {
fmt.Fscanf(in, "%d%d", &gaps[i][0], &gaps[i][1])
}
if solve(w, gaps) {
fmt.Fprintln(out, "yes")
} else {
fmt.Fprintln(out, "no")
}
if kase > 1 {
fmt.Fprintln(out)
}
}
}