結果
問題 | No.2357 Guess the Function |
ユーザー |
|
提出日時 | 2023-06-23 23:02:52 |
言語 | Go (1.23.4) |
結果 |
RE
|
実行時間 | - |
コード長 | 764 bytes |
コンパイル時間 | 13,624 ms |
コンパイル使用メモリ | 229,560 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 1.55 |
最終ジャッジ日時 | 2024-07-01 02:50:27 |
合計ジャッジ時間 | 14,812 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 1 RE * 8 |
ソースコード
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: panic("") 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 }