QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#146985 | #6749. Target | katarina001 | Judging | / | / | C++14 | 457b | 2023-08-22 18:05:53 | 2023-08-22 18:05:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m;
int main() {
long double a,b;
cin>>a>>b;
for(int i=1;i<=20;i++) cout<<1;
long double t=0.5;
vector<int> ans;
long double x=0;
int cnt=0;
while(b-x>1e-6) {
if(x+t<=b) x+=t,ans.push_back(2);
else ans.push_back(1);
t*=0.5;
cnt++;
}
// printf("%.10Lf\n",x);
for(int i=ans.size()-1;i>=0;i--) {
cout<<ans[i];
}
return 0;
}