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 |
---|---|---|---|---|---|---|---|---|---|
#411071 | #6749. Target | zhangmeixing | TL | 0ms | 3896kb | C++23 | 855b | 2024-05-14 21:25:29 | 2024-05-14 21:25:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define int long long
#define inf 1e18
#define rep(i, l, n) for (int i = l; i <= n; i++)
#define per(i, l, n) for (int i = n; i >= l; i--)
//cout<<fixed<<setprecision(15)
const int mol=998244353;
const int N = 3e5+10,M=5010;
int qmi(int a,int k){int res=1;while(k){if(k&1)res=res*a%mol;a=a*a%mol;k>>=1;}return res;}
int inv(int x){return qmi(x%mol,mol-2);}
int n,m,q,k;
void solve()
{
double a,b;
cin>>a>>b;
string ans="";
while(abs(a-b)>1e-4)
{
if(a>b)
{
ans+='1';
a/=2;
}
else
{
ans+='2';
a=a/2+0.5;
}
}
cout<<ans<<endl;
}
signed main()
{
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int T = 1;
//cin>>T;
for (int i = 1; i <= T; i++)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805