QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#404756 | #6749. Target | qzuser# | RE | 0ms | 3796kb | C++17 | 581b | 2024-05-04 17:13:13 | 2024-05-04 17:13:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
double p[18];
int f[20];
int main()
{
p[1] = 0.5;
for (int i = 2; i <= 15; i ++) p[i] = p[i - 1] * 0.5;
vector<int> v;
double a, b;
cin >> a >> b;
double y = b;
for (int i = 1; i <= 15; i ++)
{
if (y <= 1e-4) break;
if (y > p[i]) v.push_back(i), y -= p[i], f[i] = 1;
}
for (int i = 1; i <= 15; i ++) cout << "1";
int id = v.back();
for (int i = id; i >= 1; i --)
{
if (f[i]) cout << "2";
else cout << "1";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
0.5 0.25
output:
11111111111111122222222222211
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
1 0.75
output:
11111111111111122222222222212
result:
ok ok
Test #3:
score: -100
Runtime Error
input:
1 0