QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#618907 | #6749. Target | xiojoy# | RE | 0ms | 3732kb | C++20 | 512b | 2024-10-07 11:36:10 | 2024-10-07 11:36:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
double a, b;
cin >> a >> b;
int cnt = 0;
vector<int> p(30);
while(b > 1e-8) {
b *= 2;
if (b >= 1) {
p[cnt++] = 1;
b -= 1;
} else {
p[cnt++] = 0;
}
}
for(int i = 0; i < 20; ++i){
cout << "1";
}
for(int i = cnt - 1; i >= 0; --i){
if(p[i] == 1) cout <<"2";
else cout << "1";
}
cout << endl;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
0.5 0.25
output:
1111111111111111111121
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
1 0.75
output:
1111111111111111111122
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
1 0
output:
11111111111111111111
result:
ok ok
Test #4:
score: -100
Runtime Error
input:
0.361954 0.578805