QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#409288#6749. Targetundefined-ux#WA 1ms3880kbC++14890b2024-05-11 21:18:272024-05-11 21:18:28

Judging History

你现在查看的是最新测评结果

  • [2024-05-11 21:18:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3880kb
  • [2024-05-11 21:18:27]
  • 提交

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 {
    double a;  string path;
} Node;

double a, b;

void solve(queue<Node>& q) {
    while(!q.empty()) {
        auto now = q.front(); q.pop();
        if(abs(now.a - b) <= 1e-6) {
            cout << now.path << endl;
            return ;
        }
        if(now.path.size() >= 50) continue;
        if(b >= 0.5 || b > a) {
            q.push({(now.a + 1) / 2, now.path + "2"});
        }
        if (a > b || b <= 0.5) {
            q.push({now.a / 2, now.path + "1"});
        }
    }
}

int main() { qio
    int  t = 1;

    while(t--) {
        queue<Node> q;
        cin >> a >> b;
        q.push({a, ""});
        solve(q);
    }

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3740kb

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1 0.75

output:

12

result:

ok ok

Test #3:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

1 0

output:

11111111111111111111

result:

ok ok

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3700kb

input:

0.361954 0.578805

output:


result:

wrong answer wa