QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#383436 | #6749. Target | youxiao# | TL | 1ms | 3848kb | C++20 | 732b | 2024-04-09 14:11:11 | 2024-04-09 14:11:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=11000;
const double eps=1e-5;
int check(double x){
if(abs(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;
while(1){
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;
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: 3780kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 0
output:
11111111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...