@@ -20,8 +20,8 @@ type stdIO struct {
20
20
21
21
type (
22
22
initData struct { n int }
23
- request struct { q int } //
24
- response struct { res int }
23
+ request struct { q int }
24
+ response struct { v int }
25
25
answer struct { ans int }
26
26
)
27
27
@@ -41,19 +41,12 @@ func (io stdIO) query(q request) (resp response) {
41
41
Fprintln (out , "?" , q .q )
42
42
//Fprint(out, "?")
43
43
//Fprint(out, " ", len(q.q)) // TODO 输出 query 长度?
44
- //for _, v := range q.q {
45
- // Fprint(out, " ", v)
46
- //}
44
+ //for _, v := range q.q { Fprint(out, " ", v) }
47
45
//Fprintln(out)
48
46
49
47
out .Flush ()
50
-
51
- Fscan (in , & resp .res )
52
-
53
- // TODO: 题目定义了 incorrect request?
54
- if resp .res < 0 {
55
- panic (- 1 )
56
- }
48
+ Fscan (in , & resp .v )
49
+ //if resp.v < 0 { panic(-1) }
57
50
return
58
51
}
59
52
@@ -63,18 +56,15 @@ func (io stdIO) printAnswer(a answer) {
63
56
Fprintln (out , "!" , a .ans )
64
57
//Fprint(out, "!")
65
58
//Fprint(out, " ", len(a.ans)) // TODO 输出答案长度?
66
- //for _, v := range a.ans {
67
- // Fprint(out, " ", v)
68
- //}
59
+ //for _, v := range a.ans { Fprint(out, " ", v) }
69
60
//Fprintln(out)
70
61
71
62
out .Flush ()
72
63
73
64
// TODO judge 是否返回答案非法?(通常是 move on to the next test case)
74
- //var res int
75
- //if Fscan(io.in, &res); res < 0 {
76
- // panic(res)
77
- //}
65
+ //var state int
66
+ //Fscan(io.in, &state)
67
+ //if state < 0 { panic(state) }
78
68
}
79
69
80
70
func doInteraction (it interaction ) {
@@ -84,13 +74,11 @@ func doInteraction(it interaction) {
84
74
_ = n
85
75
86
76
// TODO query 格式?
87
- q := func (q int ) int {
88
- //for i := range q {
89
- // q[i]++
90
- //}
91
- return it .query (request {q }).res
77
+ get := func (q int ) int {
78
+ //for i := range q { q[i]++ }
79
+ return it .query (request {q }).v
92
80
}
93
- _ = q
81
+ _ = get
94
82
95
83
// TODO 答案类型?
96
84
var ans int
@@ -101,6 +89,9 @@ func doInteraction(it interaction) {
101
89
102
90
}
103
91
92
+ // TODO: 运行 & 测试!检查格式是否正确
93
+ func main () { run () }
94
+
104
95
func run () {
105
96
in := bufio .NewReader (os .Stdin )
106
97
out := bufio .NewWriter (os .Stdout )
@@ -112,6 +103,3 @@ func run() {
112
103
doInteraction (stdIO {in , out })
113
104
}
114
105
}
115
-
116
- // TODO: 运行 & 测试!检查格式是否正确
117
- func main () { run () }
0 commit comments