QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#412936 | #6749. Target | Zhaz | WA | 1ms | 3968kb | C++17 | 650b | 2024-05-16 21:51:18 | 2024-05-16 21:51:19 |
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;
int cnt=0;
while(abs(a-b)>eps){
cnt++;
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);
}
if(cnt>=45)break;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3804kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
1 0
output:
111111111111111111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3920kb
input:
0.361954 0.578805
output:
212121212121212121212121212121212121212121212
result:
wrong answer wa