QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#55061 | #1777. Fortune From Folly | MIT01# | WA | 197ms | 3908kb | C++ | 1.1kb | 2022-10-12 08:02:59 | 2022-10-12 08:03:02 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define maxn 500005
#define mod 998244353
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll ksm(ll a, ll b) {if (b == 0) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns;}
using namespace std;
#define db double
db res[1 << 6];
int main() {
int n, k;
db p;
cin >> n >> k >> p;
const int md = (1 << n) - 1;
for (int j = 0; j < 20000000; j++) {
for (int i = 0; i < (1 << n); i++) {
if (__builtin_popcount(i) >= k)
res[i] = 0;
else res[i] = 1 + p * res[((i << 1) + 1) & md] + (1 - p) * res[(i << 1) & md];
}
}
db ans = res[0];
printf("%.10lf\n", ans);
return 0;
}
/*
3
3 6 1 1 4 1 2 2 4 9 1 4 2 3 3 2 4 1 10 14 10 8 1 6 2 5 4 2 5 5 8 9 2 7 6 8 6 5 7 4
*/
詳細信息
Test #1:
score: 100
Accepted
time: 77ms
memory: 3692kb
input:
2 1 0.0006
output:
1666.6666666664
result:
ok found '1666.6666667', expected '1666.6666667', error '0.0000000'
Test #2:
score: 0
Accepted
time: 76ms
memory: 3692kb
input:
2 1 0.0043
output:
232.5581395349
result:
ok found '232.5581395', expected '232.5581395', error '0.0000000'
Test #3:
score: 0
Accepted
time: 109ms
memory: 3716kb
input:
2 1 0.4202
output:
2.3798191337
result:
ok found '2.3798191', expected '2.3798191', error '0.0000000'
Test #4:
score: 0
Accepted
time: 75ms
memory: 3712kb
input:
2 1 0.6729
output:
1.4861049190
result:
ok found '1.4861049', expected '1.4861049', error '0.0000000'
Test #5:
score: 0
Accepted
time: 71ms
memory: 3908kb
input:
2 1 0.9925
output:
1.0075566751
result:
ok found '1.0075567', expected '1.0075567', error '0.0000000'
Test #6:
score: 0
Accepted
time: 77ms
memory: 3816kb
input:
2 1 0.9999
output:
1.0001000100
result:
ok found '1.0001000', expected '1.0001000', error '0.0000000'
Test #7:
score: -100
Wrong Answer
time: 197ms
memory: 3864kb
input:
2 2 0.0006
output:
2777369.3530103788
result:
wrong answer 1st numbers differ - expected: '2779444.4444444', found: '2777369.3530104', error = '0.0007466'