QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#372531 | #6749. Target | Qian# | WA | 1ms | 4092kb | C++14 | 730b | 2024-03-31 14:58:17 | 2024-03-31 14:58:19 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define pii pair<int, int>
const int N = 1e6 + 10;
#define esp 1e-4
void solve()
{
dd a,b;
cin>>a>>b;
if(fabs(a-b)<=esp)return ;
vector<int>B,A;
while(fabs(a-(int) a)>esp)A.push_back(1),a/=2;
a=0;
for(dd now=0.5;fabs(a-b)>esp;now/=2){
if(a+now<b)B.push_back(2),a+=now;
else B.push_back(1);
}
reverse(B.begin(),B.end());
if(A.size()+B.size()>50)while(1);
for(auto it:A)printf("%d",it);
for(auto it:B)printf("%d",it);
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int _ = 1;
while (_--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4092kb
input:
0.5 0.25
output:
111111111111122222222222211
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
1 0.75
output:
22222222222212
result:
ok ok
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3620kb
input:
1 0
output:
result:
wrong answer wa