QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#383528 | #6749. Target | qzhfx# | WA | 0ms | 3952kb | C++23 | 1.1kb | 2024-04-09 15:17:36 | 2024-04-09 15:17:36 |
Judging History
answer
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math,no-stack-protector")
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;
using ll = int64_t;
using LL = long long;
using ull = uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using pii = pair<ll, ll>;
const int mod = 998244353;
const int N = 1e6 + 7;
const int maxn = 1e5 + 100;
const double eps = 1e-4;
void solve() {
double a, b;
const double s = 0.5;
cin >> a >> b;
vector<int>ans,v;
while(fabs(a)>eps){
a = a * 0.5;
v.push_back(1);
}
while(1){
if(fabs(1.0-b)<eps||ans.size() > 40){
break;
}
if(b*2.0>1){
b = 2.0 * b - 1.0;
ans.push_back(2);
}else {
b = b * 2.0;
ans.push_back(1);
}
// cerr << b << '\n';
}
while(fabs(1.0-a)>eps){
ans.push_back(2);
a = a * 0.5 + 0.5;
}
reverse(ans.begin(),ans.end());
for(auto x:v){
cout << x ;
}
for(auto x:ans){
cout << x;
}
cout << '\n';
}
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int _;
_ = 1;
// cin >> _;
while (_--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3688kb
input:
0.5 0.25
output:
11111111111112222222222222211
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1 0.75
output:
111111111111112222222222222212
result:
ok ok
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3952kb
input:
1 0
output:
111111111111112222222222222211111111111111111111111111111111111111111
result:
wrong answer wa