QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#409635 | #6749. Target | asoulcoming# | WA | 1ms | 3664kb | C++20 | 552b | 2024-05-12 13:46:03 | 2024-05-12 13:46:04 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define lowbit(x) x&(-x)
#define endl '\n'
using namespace std;
const int N=2e5+10;
const int mod=998244353;
const double eps=1e-6;
typedef pair<int,int>PII;
void solve()
{
double a,b;
cin>>a>>b;
string s;
while(fabs(a-b)>eps)
{
if(a>b)a=a*0.5,s+='1';
else a=(a-1)*0.5+1.0,s+='2';
if(s.size()>49)break;
}
cout<<s<<endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
// cin>>t;
while(t--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3664kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
1 0
output:
11111111111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3660kb
input:
0.361954 0.578805
output:
21212121212121212121212121212121212121212121212121
result:
wrong answer wa