結果
問題 | No.2357 Guess the Function |
ユーザー |
![]() |
提出日時 | 2023-06-30 09:47:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 1,000 ms |
コード長 | 591 bytes |
コンパイル時間 | 216 ms |
コンパイル使用メモリ | 40,768 KB |
実行使用メモリ | 25,336 KB |
平均クエリ数 | 2.91 |
最終ジャッジ日時 | 2024-07-06 22:38:57 |
合計ジャッジ時間 | 1,417 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
/* -*- coding: utf-8 -*-** 2357.cc: No.2357 Guess the Function - yukicoder*/#include<cstdio>#include<algorithm>using namespace std;/* constant *//* typedef *//* global variables *//* subroutines */int query(int x) {printf("? %d\n", x); fflush(stdout);int r;scanf("%d", &r);return r;}/* main */int main() {int r0 = query(100);int a, b;if (r0 == 99) {a = 99, b = 100;}else {int r1 = query(99 - r0);b = r1 + 1;a = r0 - 100 % b;if (a < 0) a += b;}printf("! %d %d\n", a, b); fflush(stdout);return 0;}