QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#407530 | #6749. Target | mxxnez# | WA | 1ms | 3876kb | C++17 | 829b | 2024-05-08 22:12:36 | 2024-05-08 22:12:38 |
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 (tmp > esp){
while (tmp < 1.0 / x)
{
x *= 2;
cnt++;
}
tmp -= (1.0 / x);
t.push_back(cnt);
x *= 2; cnt++;
}
tmp = a;
while (abs(tmp) > esp){
tmp /= 2;
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;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3876kb
input:
0.5 0.25
output:
111111111111121
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1 0.75
output:
1111111111111122
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3720kb
input:
0.361954 0.578805
output:
1111111111112111111112111111121112112
result:
wrong answer wa