QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#425311 | #6749. Target | syss | TL | 0ms | 3972kb | C++20 | 533b | 2024-05-30 08:23:24 | 2024-05-30 08:23:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const double eps = 1e-6;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout << fixed << setprecision(5);
string ans;
double a, b;
cin >> a >> b;
while (abs(a - b) > eps) {
if (a > b) {
a /= 2;
ans += '1';
} else {
a = (a - 1) / 2 + 1;
ans += '2';
}
}
cout << ans << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3748kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
1 0
output:
11111111111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805