QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#411238 | #6749. Target | KunoSayo | RE | 0ms | 3712kb | C++23 | 2.5kb | 2024-05-15 10:26:21 | 2024-05-15 10:26:22 |
Judging History
answer
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCUnusedTypeAliasInspection"
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
typedef unsigned long long ull;
typedef long long ll;
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
using namespace std;
template<typename T, typename U>
T check_read(T left, U right) {
T val;
if (cin >> val) {
if (val < left || val > right) {
throw "??";
}
return val;
}
throw "?";
}
const int MAXN = 1e5 + 9;
ull mod = 998244353;
ull fpow(ull x, ull n) {
ull ret = 1;
while (n) {
if (n & 1) ret = ret * x % mod;
n >>= 1;
x = x * x % mod;
}
return ret;
}
int b[10];
map<vector<char>, ull> dp;
int n;
ull divcache[12];
ull dfs(vector<char> &cur) {
// E(..) = 1 + (1/n) E(..-1, ..) +
// + (nz / n) E(..)
// (n-nz/n) E(..) = 1 + ..
// E(..) = n / (n - nz) (before)
auto it = dp.find(cur);
if (it != dp.end()) {
return it->second;
}
ull ret = 1;
ull nz = 0;
for (int i = 0; i < n; ++i) {
if (cur[i] > 0) {
--cur[i];
ull result = dfs(cur);
ret += result * divcache[n];
ret %= mod;
++cur[i];
} else if (cur[i] == 0) {
++nz;
}
}
if (nz) {
ret *= n;
ret %= mod;
ret *= divcache[n - nz];
ret %= mod;
}
dp[cur] = ret;
return ret;
}
void solve() {
double u;
double d = 0.975;
cin >> u >> d;
ull data = *(ull *) &d;
int exp = 0;
for (int i = 62; i >= 52; --i) {
exp = (exp << 1) | ((data >> i) & 1);
}
exp -= 1023;
++exp;
int after_ans = 1 - exp;
int ops = 0;
// 2 - 51
// 1 - 50
// 0 - 49
for (int i = 0, j = after_ans + 2; i < 50 - after_ans; ++i, ++j) {
cout << (1 + ((data >> j) & 1));
if (++ops >= 50) throw "impossible.";
}
cout << 2;
for (int i = exp; i < 0; ++i) {
cout << 1;
if (++ops >= 50) throw "?";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout << fixed;
cout.precision(18);
int T = 1;
while (T--) {
solve();
}
return 0;
}
#pragma clang diagnostic pop
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
0.5 0.25
output:
11111111111111111111111111111111111111111111111121
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1 0.75
output:
11111111111111111111111111111111111111111111111122
result:
ok ok
Test #3:
score: -100
Runtime Error
input:
1 0