QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#411246 | #6749. Target | KunoSayo | WA | 1ms | 3696kb | C++23 | 2.6kb | 2024-05-15 10:33:05 | 2024-05-15 10:33:06 |
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;
if (d == 1.0) {
d -= 1e-9;
}
ull data = *(ull *) &d;
int exp = 0;
for (int i = 62; i >= 52; --i) {
exp = (exp << 1) | ((data >> i) & 1);
}
exp -= 1023;
++exp;
if (exp > 0) {
throw "?";
}
int after_ans = 1 - exp;
int ops = 0;
for (int i = after_ans + 2; i <= 51; ++i) {
cout << (1 + ((data >> i) & 1));
// if (++ops > 50) throw "?";
}
cout << 2;
// if (++ops > 50) throw "?";
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: 1ms
memory: 3660kb
input:
0.5 0.25
output:
11111111111111111111111111111111111111111111111121
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
1 0.75
output:
11111111111111111111111111111111111111111111111122
result:
ok ok
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3688kb
input:
1 0
output:
211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
result:
wrong answer wa