QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#410339 | #6749. Target | yi_y# | TL | 0ms | 0kb | C++11 | 496b | 2024-05-13 21:48:27 | 2024-05-13 21:48:27 |
answer
#include <bits/stdc++.h>
using namespace std;
double a , b;
int f(double a , double b,int i){
double t,tt;
t=(a-b);
tt=t*pow(2,i);
if(tt==1) return 1;
else return 0;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> a >> b;
int i = 1;
while(fabs(a-b)>0.00001){
if(a*0.5>=b||f(a,b,i)==1){
cout << 1;
a=a*0.5;
}
if(a*0.5<b){
cout << 2;
a=a*0.5+0.5;
}
/*cout << endl;
cout << a << endl;*/
i++;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
0.5 0.25
output:
121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212...