QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412932#6749. TargetZhazTL 1ms3704kbC++17591b2024-05-16 21:50:052024-05-16 21:50:06

Judging History

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

  • [2024-05-16 21:50:06]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3704kb
  • [2024-05-16 21:50:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define PII pair<double,int>
double f1(double a,double s){
    return a*s;
}
double f2(double a,double s){
    return (a-1)*s+1;
}
const double eps=1e-8;
signed main(){
    double a,b;
    cin>>a>>b;
    double s=0.5;
    while(abs(a-b)>eps){
        double X=abs(f1(a,s)-b);
        double Y=abs(f2(a,s)-b);
        if(X>Y){
            printf("2");
            a=f2(a,s);
        }
        else{
            printf("1");
            a=f1(a,s);
        }
    }

    
    
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3676kb

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

111111111111111111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:

212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...

result: