QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#383447#6749. Targetyouxiao#WA 0ms3868kbC++20771b2024-04-09 14:15:092024-04-09 14:15:09

Judging History

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

  • [2024-04-09 14:15:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3868kb
  • [2024-04-09 14:15:09]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=11000;
const double eps=1e-5;
#define endl '\n'
int check(double x){
    if(fabs(x)<eps)return 0;
    if(x>0)return 1;
    return -1;
}

int main(){
    #ifdef LOCAL
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    #endif
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    double a,b;
    cin>>a>>b;
    int st=50;
    while(st--){
        int f=check(a-b);
        // cerr<<a<<" "<<b<<endl;
        if(f==0){
            break;
        }
        if(f==1){
            a/=2.0;
            cout<<1;
        }
        if(f==-1){
            a=(a+1.0)/2.0;
            cout<<2;
        }
    }
    cout<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111111

result:

ok ok

Test #4:

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

input:

0.361954 0.578805

output:

21212121212121212121212121212121212121212121212121

result:

wrong answer wa