QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#406539#6749. Targetpoxiao01WA 0ms3900kbC++20682b2024-05-07 13:30:452024-05-07 13:30:46

Judging History

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

  • [2024-05-07 13:30:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3900kb
  • [2024-05-07 13:30:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x; i<=y; ++i)
#define pre(i,x,y) for(int i=x; i>=y; --i)
const int N = 1e5 + 10, M = 4e3 + 10;
const ll INF = 1e17;
#define int long long
const double eps = 1e-4;

void solve(){
    double a, b;
    cin >> a >> b;
    string s;
    while(fabs(a - b) > eps && s.size() <= 50) {
        if(a - b > eps) a *= 0.5, s += '1';
        else    a = a * 0.5 + 0.5, s += '2';
    }
    cout << s;
}

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int t = 1;
//    cin >> t;
    while(t --) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3900kb

input:

0.361954 0.578805

output:

212121212121212121212121212121212121212121212121212

result:

wrong answer wa