QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#418406 | #6749. Target | Texcavator# | WA | 0ms | 3876kb | C++20 | 1.1kb | 2024-05-23 13:40:54 | 2024-05-23 13:40:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
using i64 = long long;
typedef pair<int, int> PII;
typedef pair<int, char> PIC;
typedef pair<double, double> PDD;
typedef pair<int, PII> PIII;
typedef pair<int, pair<int, bool>> PIIB;
const int N = 1e5 + 10;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int mod1 = 954169327;
const int mod2 = 906097321;
const int INF = 0x3f3f3f3f3f3f3f3f;
void solve()
{
double a, b;
cin >> a >> b;
int cnt = 0;
vector<int> op;
function<void(double)> dfs = [&](double x)
{
if (abs(x - b) <= 0.0001)
{
for (auto t : op) cout << t;
exit(0);
}
cnt ++ ;
if (cnt > 50) return;
if (x > b)
{
op.push_back(1);
dfs(1.0 * x / 2);
op.pop_back();
op.push_back(2);
dfs(1.0 * x / 2 + 0.5);
op.pop_back();
}
else
{
op.push_back(2);
dfs(1.0 * x / 2 + 0.5);
op.pop_back();
op.push_back(1);
dfs(1.0 * x / 2);
op.pop_back();
}
};
dfs(a);
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t = 1;
// cin >> t;
while (t--)
{
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3664kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3668kb
input:
0.361954 0.578805
output:
result:
wrong answer wa