QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#412932 | #6749. Target | Zhaz | TL | 1ms | 3704kb | C++17 | 591b | 2024-05-16 21:50:05 | 2024-05-16 21:50:06 |
Judging History
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...