QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#395305 | #6749. Target | frozen_wjl | TL | 0ms | 3856kb | C++23 | 358b | 2024-04-21 13:05:52 | 2024-04-21 13:05:52 |
Judging History
answer
#include<cmath>
#include<iostream>
using namespace std;
string ans = "";
int main()
{
int n;
double a, b, c = 0.5, k = 0;
cin >> a >> b;
while (abs(a - b) >= 0.0001)
{
if (b > k + c)
{
k += c;
a = (a + 1) / 2;
ans += "2";
}
else
{
a /= 2;
ans += "1";
}
c /= 2;
}
cout << ans << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1 0.75
output:
212
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805