0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 07:38:49 +00:00
OI-codes/LibreOJ/6/6.go

39 lines
672 B
Go

package main
import "fmt"
func main() {
var n int
var ans [105]int
fmt.Println("get_num")
fmt.Scan(&n)
for i := 0; i < n; i++ {
l, r := 1, 1000000
for l <= r {
mid := (l + r) >> 1
fmt.Println("guess", i, mid)
var res int
fmt.Scan(&res)
if res == 0 {
ans[i] = mid
break
} else if res > 0 {
r = mid - 1
} else { // res < 0
l = mid + 1
}
}
}
fmt.Print("submit ")
for i := 0; i < n; i++ {
fmt.Printf("%d ", ans[i])
}
fmt.Printf("\n")
}