QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#407907 | #6749. Target | zhoujiu# | TL | 1ms | 3904kb | C++14 | 505b | 2024-05-09 14:33:26 | 2024-05-09 14:33:27 |
Judging History
answer
#include<bits/stdc++.h>
// #define int long long
using namespace std;
const double eps=1e-4;
// int n,m;
void solve()
{
double a,b;
cin>>a>>b;
vector<int> q;
while(fabs(a-b)>eps)
{
if(a>b)
{
a=a/2;
q.push_back(1);
}
else
{
a=a/2+0.5;
q.push_back(2);
}
}
for(auto it:q) cout<<it;
}
signed main()
{
ios::sync_with_stdio(false);
cin.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: 0ms
memory: 3652kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805