QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#151417#5556. Diabolic DoofenshmirtzShulker_WA 0ms3536kbC++23994b2023-08-26 17:08:452023-08-26 17:08:47

Judging History

你现在查看的是最新测评结果

  • [2023-08-26 17:08:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3536kb
  • [2023-08-26 17:08:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PII pair<ll,ll>
#define inf 0x3f3f3f3f
#define inff 0x3f3f3f3f3f3f3f3f
#define mem(a,b) memset(a,b,sizeof a)
#define endl '\n'
const ll N=1e6+5;
const double eps=1e-6;
const ll mod=998244353;
const double pi=3.141592653589;
const double ol=0.57721566490153286060651209;
ll n,m,k;
ll ask(ll x)
{
    cout<<"? "<<x<<endl;
    ll pp;cin>>pp;
    return pp;
}
void solve()
{
    cout<<"? 1"<<endl;
    ll x;
    cin>>x;
    if(x==0)
    {
        cout<<1<<endl;return ;
    }
    ll now=2;
    ll last=1;
    while(ask(now)>last)
    {
        now*=2;
        last*=2;
    }
    
    ll pp=ask(now);
    cout<<"! "<<now-pp<<endl;

/*65
1 1
2 2
4 4
8 8
16 16
32 32
64 64
128 63*/
}
int main(){
    //ios::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
    ll tt = 1 ;
    //cin>>tt;
    while(tt--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3536kb

input:

1
2
4
8
16
32
22

output:

? 1
? 2
? 4
? 8
? 16
? 32
? 64
? 64

result:

wrong answer Integer 64 violates the range [65, 1000000000000000001]