QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387433#6749. Targetk1nsomWA 0ms3932kbC++17832b2024-04-12 15:02:422024-04-12 15:02:42

Judging History

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

  • [2024-04-12 15:02:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3932kb
  • [2024-04-12 15:02: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置'零'
    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 = 0;
    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: 3932kb

input:

0.5 0.25

output:

11111111111112121212121212121212121212121212121211
0.249999

result:

wrong answer wa