QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387438#6749. Targetk1nsomWA 0ms3792kbC++17870b2024-04-12 15:05:422024-04-12 15:05:42

Judging History

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

  • [2024-04-12 15:05:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3792kb
  • [2024-04-12 15:05:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define N 200005
#define double long double
#define endl '\n'
double a, b, x;
int ans[N] = {0};
signed main()
{
    cin >> a >> b;
    /*
    操作一:a=a*0.5;等价于b=b*2;
    操作二:a=a+0.5;等价于b=b-0.5
     */
    for (int i = 1; i <= 12; i++)
    {
        cout << 1;
        a *= 0.5;
    } // a置'零'
    for (int i = 1; i <= 38; i++)
    {
        if (b - 0.5 > 1e-4)
        {
            b -= 0.5;
            ans[i] = 2;
        }
        else
        {
            b *= 2;
            ans[i] = 1;
        }
    }
    x = a;
    for (int i = 38; i >= 1; i--)
    {
        if (ans[i] == 1)
            x = x * 0.5;
        else
            x = x + 0.5;
        cout << ans[i];
    }
    // cout << endl
    //     << x;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3792kb

input:

0.5 0.25

output:

11111111111112121212121212121212121212121212121211

result:

wrong answer wa