結果

問題 No.2357 Guess the Function
ユーザー hiro71687khiro71687k
提出日時 2023-06-28 14:05:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 968 bytes
コンパイル時間 4,372 ms
コンパイル使用メモリ 260,232 KB
実行使用メモリ 24,372 KB
平均クエリ数 2.55
最終ジャッジ日時 2023-09-18 16:47:50
合計ジャッジ時間 6,371 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 27 ms
24,336 KB
testcase_02 AC 26 ms
24,372 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 25 ms
24,144 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 26 ms
24,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=20000000000000;
ll mod=998244353;
int main(){
    cout << "? 2" << endl;
    ll a,b;
    ll x;
    cin >> x;
    if (x>=2)
    {
        a=x-2;
        cout << "? 100" << endl;
        ll y=a+100;
        ll z;
        cin >> z;
        ll ans=y-z;
        if (ans>100)
        {
            for (ll i = 2; i < 100; i++)
            {
                if (a%i!=0&&ans%i==0)
                {
                    ans/=i;
                    break;
                }
            }
        }
        cout << "! " << a << ' ' << ans << endl;
    }else{
        cout << "? 0" << endl;
        ll a;
        cin >> a;
        for (ll i = a+1; i <100; i++)
        {
            if ((a+2)%i==x)
            {
                cout << "! " << a << ' ' << i << endl;
            }
            
        }
    }
}
0