結果

問題 No.2357 Guess the Function
ユーザー Kyo_s_sKyo_s_s
提出日時 2023-06-23 22:23:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 1,000 ms
コード長 464 bytes
コンパイル時間 2,171 ms
コンパイル使用メモリ 198,400 KB
実行使用メモリ 24,252 KB
平均クエリ数 2.91
最終ジャッジ日時 2023-09-13 17:23:59
合計ジャッジ時間 3,137 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
23,988 KB
testcase_01 AC 24 ms
23,592 KB
testcase_02 AC 23 ms
23,760 KB
testcase_03 AC 23 ms
23,892 KB
testcase_04 AC 24 ms
23,976 KB
testcase_05 AC 23 ms
23,568 KB
testcase_06 AC 23 ms
23,460 KB
testcase_07 AC 24 ms
23,340 KB
testcase_08 AC 24 ms
23,640 KB
testcase_09 AC 23 ms
23,340 KB
testcase_10 AC 23 ms
24,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;


int main() {

  cout << "? 100" << endl;
  int a; cin >> a;
  if (a == 99) {
    cout << "! " << 99 << " " << 100 << endl;
    exit(0);
  }
  cout << "? " << 100 - a - 1 << endl;
  int b; cin >> b;
  int B = b + 1;  

  for (int A = 0; A < B; A++) {
    if (!((A + 100) % B == a)) continue;
    if (!((A + 100 - a - 1) % B == b)) continue;
    cout << "! " << A << " " << B << endl;
    exit(0);
  }
  exit(1);
  

} 
0