QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#409305 | #6749. Target | undefined-ux# | WA | 1ms | 3772kb | C++14 | 862b | 2024-05-11 21:29:50 | 2024-05-11 21:29:50 |
Judging History
answer
#include <bits/stdc++.h>
#define qio std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
using namespace std;
const int N = 1e5 + 20;
typedef pair<int, int> PII;
typedef struct {
long double a; string path;
} Node;
long double a, b;
void solve(queue<Node>& q) {
while(!q.empty()) {
auto now = q.front(); q.pop();
if(abs(now.a - b) <= 1e4) {
cout << now.path << endl;
return ;
}
if(now.path.size() >= 50) continue;
if (a > b) {
q.push({now.a / 2, now.path + "1"});
}else {
q.push({(now.a + 1) / 2, now.path + "2"});
}
}
}
int main() { qio
int t = 1;
while(t--) {
queue<Node> q;
cin >> a >> b;
q.push({a, ""});
solve(q);
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3772kb
input:
0.5 0.25
output:
result:
wrong answer wa