QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#414325 | #6749. Target | fuyouyufeng# | WA | 1ms | 3780kb | C++17 | 957b | 2024-05-18 21:21:21 | 2024-05-18 21:21:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int p = 998244353;
double s = 0.5;
bool check(double a, double b)
{
return abs(a - b) <= 1e-4;
}
vector<int> res;
int main()
{
double a, b;
cin >> a >> b;
for (int k = 0; k <= 50; k++)
{
bool ok = false;
for (int l = 0; l <= k; l++)
{
double t = a;
for (int i = 1; i <= l; i++)
t *= 0.5;
for (int i = 1; i <= k - l; i++)
t = t * 0.5 + 0.5;
if (check(t, b))
{
for (int i = 1; i <= l; i++)
res.push_back(1);
for (int i = 1; i <= k - l; i++)
res.push_back(2);
ok = true;
break;
}
}
if (ok)
break;
}
for (int i = 0; i < res.size(); i++)
cout << res[i];
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3720kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3720kb
input:
0.361954 0.578805
output:
result:
wrong answer wa