QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#402046 | #6749. Target | iwew# | TL | 0ms | 3784kb | C++20 | 495b | 2024-04-29 19:58:06 | 2024-04-29 19:58:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const double eps = 1e-4;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
double a, b;
cin >> a >> b;
const double s = 0.5;
auto up = [&](double &v) -> void {
v = (v - 1) * s + 1;
};
auto down = [&](double &v) -> void {
v = v * s;
};
string ans;
while(fabs(a - b) > eps) {
if(a < b) {
up(a);
ans += '2';
} else {
down(a);
ans += '1';
}
}
cout << ans << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805