QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#410802 | #6749. Target | orzkeyhacker# | WA | 1ms | 3780kb | C++20 | 1.3kb | 2024-05-14 15:06:33 | 2024-05-14 15:06:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define lc p<<1
#define rc p<<1|1
//#define int long long
#define mp make_pair
#define vi vector<int>
#define vc vector<char>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define vvpi vector<vector<pair<int,int>>>
typedef long long ll;
typedef tuple<int,int,int> tp;
typedef pair<int,int> PII;
typedef pair<ll,pair<ll,ll>> PIII;
typedef pair<ll,pair<ll,pair<ll,ll>>> pIIII;
const int N = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
void solve() {
vi ans;
double a, b;cin >> a >> b;
while(abs(a - b) > 0.0001) {
if(a > b) {
ans.push_back(1);
a = a*0.5;
} else {
ans.push_back(2);
a = a*0.5 + 0.5;
}
if(ans.size() >= 50) break;
}
//cout << fixed << setprecision(10) << a << "\n";
for(auto i : ans) {
cout << i;
}
cout << "\n";
}
signed main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int t = 1;
//cin >> t;
while(t--) {
solve();
}
return 0;
}
/*
Do smth instead of nothing and stay organized
Don't get stuck on one approach
*/
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3780kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3672kb
input:
0.361954 0.578805
output:
21212121212121212121212121212121212121212121212121
result:
wrong answer wa