-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy path11498.go
More file actions
47 lines (41 loc) · 754 Bytes
/
Copy path11498.go
File metadata and controls
47 lines (41 loc) · 754 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
43
44
45
46
47
// UVa 11498 - Division of Nlogonia
package main
import (
"fmt"
"os"
)
type point struct{ x, y int }
func country(division point, p point) string {
switch {
case p.x == division.x || p.y == division.y:
return "divisa"
case p.x > division.x:
if p.y > division.y {
return "NE"
}
return "SE"
default:
if p.y > division.y {
return "NO"
}
return "SO"
}
}
func main() {
in, _ := os.Open("11498.in")
defer in.Close()
out, _ := os.Create("11498.out")
defer out.Close()
var k int
var division, p point
for {
if fmt.Fscanf(in, "%d", &k); k == 0 {
break
}
fmt.Fscanf(in, "%d%d", &division.x, &division.y)
for ; k > 0; k-- {
fmt.Fscanf(in, "%d%d", &p.x, &p.y)
fmt.Fprintln(out, country(division, p))
}
}
}