QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#407537 | #6749. Target | mxxnez# | WA | 1ms | 3888kb | C++17 | 848b | 2024-05-08 22:42:40 | 2024-05-08 22:42:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const double esp = 1e-4;
#define i64 long long
void solve(){
double a,b;// int cnt = 0;
cin >> a >> b;
// cout << a << b;
if (abs(a - b) <= esp){
cout << endl;
return;
}
double tmp = b;
vector<int> t;
int x = 2, cnt = 1;
while (abs(tmp) > esp){
while (tmp < 1.0 / x)
{
x *= 2;
cnt++;
}
tmp -= (1.0 / x);
tmp = abs(tmp);
t.push_back(cnt);
x *= 2; cnt++;
}
tmp = a;
for(int i = 0 ; i < 20 ; i++){
cout << 1;
}
for (int i = t.size() - 1; i >= 0; i--){
cout << 2;
for (int j = i; j < t[i] - 1; j++)
cout << 1;
}
cout << endl;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3668kb
input:
0.5 0.25
output:
1111111111111111111121
result:
ok ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
1 0.75
output:
1111111111111111111122
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
1 0
output:
11111111111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3784kb
input:
0.361954 0.578805
output:
111111111111111111112111111112111111121112112
result:
wrong answer wa