結果
| 問題 |
No.2357 Guess the Function
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-23 22:49:07 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 742 bytes |
| コンパイル時間 | 15,294 ms |
| コンパイル使用メモリ | 225,568 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 3.00 |
| 最終ジャッジ日時 | 2024-07-01 02:34:55 |
| 合計ジャッジ時間 | 12,611 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 10 |
ソースコード
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
}