QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#383592 | #6749. Target | GordenGhost# | TL | 1ms | 3752kb | C++20 | 651b | 2024-04-09 15:43:03 | 2024-04-09 15:43:04 |
Judging History
answer
#include"bits/stdc++.h"
#define endl '\n'
using ll=long long;
using namespace std;
constexpr int N=10000000+5,mod=998244353;
void slove(){
double a,b;
vector<int>an;
cin>>a>>b;
if(b<=0.00001&&b>=-0.00001){
while(abs(a-b)>0.00001){
a*=0.5;
cout<<1;
}
cout<<endl;
return ;
}
else{
while(abs(a-b)>0.00001){
if(b*2>1){
b=b*2-1;
an.push_back(2);
}
else{
b*=2;
an.push_back(1);
}
}
}
for(int i=an.size()-1;i>=0;i--){
cout<<an[i];
}cout<<endl;
}
signed main(){
cin.tie(nullptr)->sync_with_stdio(0);
int _=1;
// cin>>_;
while(_--){
slove();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3688kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
1 0
output:
11111111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805