QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#407541 | #6749. Target | mxxnez# | WA | 0ms | 3724kb | C++17 | 866b | 2024-05-08 22:57:08 | 2024-05-08 22:57:08 |
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;
}
string s=" ";
for (int i = t.size() - 1; i >= 0; i--){
s = "2"+s;
for (int j = i; j < t[i] - 1; j++)
s= "1"+s;
}
cout <<s<< 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: 0
Wrong Answer
time: 0ms
memory: 3724kb
input:
0.5 0.25
output:
1111111111111111111112
result:
wrong answer wa