QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#414343 | #6749. Target | fuyouyufeng# | WA | 0ms | 3704kb | C++17 | 804b | 2024-05-18 21:39:40 | 2024-05-18 21:39:41 |
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;
bool flag = false;
void dfs(double a, double b, int op)
{
if(op == 50)
{
return;
}
if(flag == true){
return;
}
if (check(a, b))
{
for(int i = 0;i<res.size();i++)
{
cout <<res[i] << " ";
}
flag =true;
return;
}
double pre = a;
a = a / 2;
res.push_back(1);
dfs(a, b, op + 1);
a = pre;
res.pop_back();
res.push_back(2);
pre = a;
a = a / 2 + 0.5;
dfs(a, b, op + 1);
res.pop_back();
a = pre;
}
int main()
{
double a, b;
cin >> a >> b;
dfs(a, b, 0);
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3704kb
input:
0.5 0.25
output:
1
result:
wrong answer wa