結果
| 問題 |
No.2357 Guess the Function
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-23 22:53:57 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 752 bytes |
| コンパイル時間 | 11,240 ms |
| コンパイル使用メモリ | 228,296 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 3.00 |
| 最終ジャッジ日時 | 2024-07-01 02:40:25 |
| 合計ジャッジ時間 | 12,356 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 WA * 6 |
ソースコード
package main
import "fmt"
func main() {
sieve := sieveOfEratosthenes(200)
fmt.Println("?", 1)
var c int
fmt.Scan(&c)
switch c {
case 0:
fmt.Println("?", 100)
var d int
fmt.Scan(&d)
a, b := d, d+1
fmt.Println("!", a, b)
default:
a := c - 1
var y int
for x := len(sieve) - 1; ; x-- {
if !sieve[x] {
continue
}
if x-a > 100 {
continue
}
y = x - a
break
}
fmt.Println("?", y)
var d int
fmt.Scan(&d)
b := (a + y) - d
fmt.Println("!", a, b)
}
}
func sieveOfEratosthenes(n int) []bool {
bs := make([]bool, n+1)
for i := 2; i < len(bs); i++ {
bs[i] = true
}
for p := 2; p <= n; p++ {
if !bs[p] {
continue
}
for x := p * p; x <= n; x += p {
bs[x] = false
}
}
return bs
}