QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#594238 | #6749. Target | LianYan | WA | 0ms | 3872kb | C++20 | 1.2kb | 2024-09-27 20:32:06 | 2024-09-27 20:32:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define up(i, a, b) for (int i = (a); i <= (b); i++)
#define dn(i, a, b) for (int i = (a); i >= (b); i--)
typedef long long ll;
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < 48 || ch > 57)
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= 48 && ch <= 57)
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
inline void write(int x)
{
if (x < 0)
{
putchar('-');
x = -x;
}
if (x > 9)
write(x / 10);
putchar(x % 10 + '0');
}
void solve()
{
double a, b;
cin >> a >> b;
if (b == 1)
b = 0.999999999;
string s;
up(i, 1, 50)
{
b *= 2;
if (b >= 1)
{
s = "1" + s;
b -= 1;
}
else
s = "0" + s;
}
for (auto i : s)
{
if (s[i] - '0')
cout << 1;
else
cout << 2;
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3872kb
input:
0.5 0.25
output:
11111111111111111111111111111111111111111111111121
result:
ok ok
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3724kb
input:
1 0.75
output:
11111111111111111111111111111111111111111111111111
result:
wrong answer wa