QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#409011 | #6749. Target | dremlory# | TL | 0ms | 3772kb | C++23 | 748b | 2024-05-11 15:27:09 | 2024-05-11 15:27:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int N = 1e6, M = 110, mod = 1e9 + 7, inf = 2e9;
const long long D = 1e12;
typedef pair<int, int> pt;
typedef long long ll;
void solve() {
double a, b;
cin >> a >> b;
while (1) {
if (abs(b - a) <= 1e-4) break;
if (a > b) {
a = 0.5 * a;
cout << 1;
}
if (a < b) {
a = 0.5 * a + 0.5;
cout << 2;
}
}
}
signed main() {
//freopen("title.in", "r", stdin);
//freopen("std.txt", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t = 1;
//cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3772kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...