結果

問題 No.2357 Guess the Function
ユーザー HIcoderHIcoder
提出日時 2023-06-23 22:00:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,117 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 83,784 KB
実行使用メモリ 24,432 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-13 17:01:36
合計ジャッジ時間 2,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const ll MOD=1e9+7;

int main(){
    vector<ll> x(2),y(2);

    x[0]=53;
    x[1]=17;

    for(int t=0;t<2;t++){
        cout<<"? "<<x[t]<<endl;
        std::fflush(stdout);
        
        std::fflush(stdin);
        cin>>y[t];

    }

    for(int a=0;a<100;a++){
        for(int b=a+1;b<=100;b++){
            vector<int> c(2);

            int cnt=0;

            for(int t=0;t<2;t++){
                c[t]=y[t]-x[t];
                c[t]%=b;
                if(c[t]<0){
                    c[t]+=b;
                    c[t]%=b;
                }
                c[t]%=b;

                if(a%b==c[t]){
                    cnt++;
                }
            }
            if(cnt==2){
                cout<<"! "<<a<<' '<<b<<endl;
                std::fflush(stdout);
                return 0;
            }


        }
    }

    
}
0