QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412839#6749. Targetincloud#TL 1ms3916kbC++14508b2024-05-16 20:13:472024-05-16 20:13:47

Judging History

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

  • [2024-05-16 20:13:47]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3916kb
  • [2024-05-16 20:13:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    double a,b;
    cin>>a>>b;
    stack<int> ans;
    double tb=b+6.10352e-05;
    while(abs(a-tb)>0.0001){
        tb*=2;
        if(abs(a-tb)<=0.0001){
            ans.push(1);
            break;
        }
        if(tb>1){
            tb-=1;
            ans.push(2);
        }
        else ans.push(1);
    }
    while(ans.size()){
        cout<<ans.top();
        ans.pop();
    }
    return 0;
}

详细

Test #1:

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

input:

0.5 0.25

output:

1111111111121

result:

ok ok

Test #2:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

1 0.75

output:

11111111111122

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:


result: