QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#425311#6749. TargetsyssTL 0ms3972kbC++20533b2024-05-30 08:23:242024-05-30 08:23:25

Judging History

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

  • [2024-05-30 08:23:25]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3972kb
  • [2024-05-30 08:23:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using LL = long long;

const double eps = 1e-6;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(5);

    string ans;
    double a, b;
    cin >> a >> b;
    while (abs(a - b) > eps) {
        if (a > b) {
            a /= 2;
            ans += '1';
        } else {
            a = (a - 1) / 2 + 1;
            ans += '2';
        }
    }

    cout << ans << '\n';

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:


result: