QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#410808 | #6749. Target | orzkeyhacker# | WA | 1ms | 3680kb | C++20 | 1.3kb | 2024-05-14 15:10:18 | 2024-05-14 15:10:19 |
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;
long double a, b;cin >> a >> b;
while(abs(a - b) > 0.00001) {
if(a == b) break;
if(a > b) {
ans.push_back(1);
a = a*0.500000000;
} else {
ans.push_back(2);
a = a*0.500000000 + 0.5000000000;
}
if(ans.size() >= 50) break;
}
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
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3580kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
1 0
output:
11111111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3680kb
input:
0.361954 0.578805
output:
21212121212121212121212121212121212121212121212121
result:
wrong answer wa