QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#411782 | #6749. Target | xiaodaiyang# | WA | 0ms | 3988kb | C++14 | 1.3kb | 2024-05-15 19:30:05 | 2024-05-15 19:30:06 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <random>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
using namespace std;
#define endl '\n'
typedef long long ll;
#define int long long
//typedef __int128_t int128;
typedef pair<int, int> PII;
typedef pair<PII, int> PIII;
const int INF = 0x3f3f3f3f, mod = 998244353;
mt19937 rng(time(0));
#define x first
#define y second
#define lowbit(x) ((x) & -(x))
//#define double long double
const int N = 510;
ll n, m;
void solve() {
double a, b;
cin >> a >> b;
for (int i = 1; i <= 50; i ++ ) {
if (fabs(a - b) <= 1e-4) break;
if (a <= b) {
cout << 2;
a = 0.5 * a + 0.5;
}
else {
cout << 1;
a = a * 0.5;
}
}
//cout << endl << a << " " << b << endl;
}
signed main()
{
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
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: 3864kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3852kb
input:
0.361954 0.578805
output:
21212121212121212121212121212121212121212121212121
result:
wrong answer wa