QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404756#6749. Targetqzuser#RE 0ms3796kbC++17581b2024-05-04 17:13:132024-05-04 17:13:13

Judging History

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

  • [2024-05-04 17:13:13]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3796kb
  • [2024-05-04 17:13:13]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
double p[18];
int f[20];
int main()
{
    p[1] = 0.5;
    for (int i = 2; i <= 15; i ++) p[i] = p[i - 1] * 0.5;
    vector<int> v;
    double a, b;
    cin >> a >> b;
    double y = b;
    for (int i = 1; i <= 15; i ++)
    {
        if (y <= 1e-4) break;
        if (y > p[i]) v.push_back(i), y -= p[i], f[i] = 1;
    }
    for (int i = 1; i <= 15; i ++) cout << "1";
    int id = v.back();
    for (int i = id; i >= 1; i --)
    {
        if (f[i]) cout << "2";
        else cout << "1";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

11111111111111122222222222211

result:

ok ok

Test #2:

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

input:

1 0.75

output:

11111111111111122222222222212

result:

ok ok

Test #3:

score: -100
Runtime Error

input:

1 0

output:


result: