QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#406689 | #6749. Target | qiang9 | WA | 1ms | 3752kb | C++17 | 715b | 2024-05-07 16:40:38 | 2024-05-07 16:41:02 |
Judging History
answer
#include<bits/stdc++.h>
using ll=long long;
//#define int ll
const int N=2e5+10;
const int mod=998244353;
const int eps=1e-4;
int a[N];
int n;
void solve()
{
double a,b;
std::cin>>a>>b;
int op=0;
while(op<=50)
{
if(std::fabs(a/2-b)>std::fabs((a+1)/2-b)){
a=(a+1)/2.0;
std::cout<<2;
}else{
a=a/2.0;
std::cout<<1;
}
op++;
if(std::fabs(a-b)<=eps)
{
return ;
}
}
}
signed main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t=1;
//std::cin>>t;
while(t--)
{
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3752kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3708kb
input:
1 0
output:
111111111111111111111111111111111111111111111111111
result:
wrong answer wa