QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#414325#6749. Targetfuyouyufeng#WA 1ms3780kbC++17957b2024-05-18 21:21:212024-05-18 21:21:21

Judging History

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

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

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