QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#151415#5556. Diabolic DoofenshmirtzShulker_WA 2ms3576kbC++14994b2023-08-26 17:07:262023-08-26 17:17:31

Judging History

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

  • [2023-08-26 17:17:31]
  • 管理员手动重测该提交记录
  • 测评结果:WA
  • 用时:2ms
  • 内存:3576kb
  • [2023-08-26 17:07:26]
  • 提交

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();
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3576kb

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]