結果

問題 No.2357 Guess the Function
ユーザー t98slidert98slider
提出日時 2023-06-23 23:35:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 607 bytes
コンパイル時間 1,438 ms
コンパイル使用メモリ 163,136 KB
実行使用メモリ 24,060 KB
平均クエリ数 2.91
最終ジャッジ日時 2023-09-13 18:44:59
合計ジャッジ時間 2,567 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,424 KB
testcase_01 AC 23 ms
23,664 KB
testcase_02 AC 23 ms
23,424 KB
testcase_03 AC 23 ms
23,376 KB
testcase_04 AC 23 ms
23,916 KB
testcase_05 AC 22 ms
24,060 KB
testcase_06 AC 23 ms
23,544 KB
testcase_07 AC 24 ms
24,036 KB
testcase_08 AC 22 ms
23,424 KB
testcase_09 AC 24 ms
23,544 KB
testcase_10 AC 24 ms
23,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cout << "? 100" << endl;
    cin >> a;
    if(a == 99){
        cout << "! " << 99 << ' ' << 100 << endl;
        return 0;
    }
    cout << "? " << 100 - a - 1 << endl;
    cin >> b;
    //(x + 100) % (b + 1) == a
    //(x + 100 - a - 1) % (b + 1) == b
    int B = b + 1;
    for(int A = 0; A < 99; A++){
        if((A + 100) % B == a && (A + 100 - a - 1) % B == b){
            cout << "! " << A << ' ' << B << endl;
            return 0;
        }
    }
}
0