QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#406719#6749. Targetpoxiao01TL 0ms0kbC++20743b2024-05-07 17:04:412024-05-07 17:05:11

Judging History

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

  • [2024-05-07 17:05:11]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-05-07 17:04:41]
  • 提交

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;
    for(int i = 1; i <= 10; ++ i) {
        s += '1';
        a *= 0.5;
    }
    while(fabs(a - b) > eps) {
        if(a >= 0.5) 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: 0
Time Limit Exceeded

input:

0.5 0.25

output:


result: