BZOJ2134 单选错位
2014-11-17 13:09
344 查看
= =是道沙茶题,直接模拟即可。。。
View Code
/************************************************************** Problem: 2134 User: rausen Language: C++ Result: Accepted Time:1292 ms Memory:78932 kb ****************************************************************/ #include <cstdio> #include <cmath> using namespace std; typedef double lf; typedef long long ll; const int N = 10000005; const ll Mod = 100000001; ll n, a, b, c, d ; inline int read() { int x = 0; char ch = getchar(); while (ch < '0' || '9' < ch) ch = getchar(); while ('0' <= ch && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x; } int main() { int i; n = read(), a = read(), b = read(), c = read(); for (d[1] = read(), i = 2; i <= n; ++i) d[i] = (d[i - 1] * a + b) % Mod; for (i = 1; i <= n; ++i) d[i] = (d[i] % c) + 1; d[n + 1] = d[1]; lf ans = 0; for (i = 1; i <= n; ++i) if (d[i] <= d[i + 1]) ans += (lf) 1.0 / d[i + 1]; else ans += (lf) 1.0 / d[i]; printf("%.3lf", ans); return 0; }
View Code
相关文章推荐
- 【BZOJ2134】单选错位 期望
- BZOJ2134: 单选错位
- bzoj 2134 单选错位(期望)
- [BZOJ2134]单选错位(概率期望)
- bzoj2134: 单选错位
- BZOJ 2134 单选错位 期望DP
- 【BZOJ2134】单选错位 概率DP
- Bzoj2134:单选错位
- 【BZOJ】2134: 单选错位 期望DP
- Bzoj2134:单选错位
- bzoj 2134: 单选错位 期望dp
- bzoj2134: 单选错位(trie)
- 【BZOJ2134】单选错位 概率DP? 貌似不算DP
- BZOJ2134: 单选错位
- BZOJ——2134: 单选错位
- 【期望DP】BZOJ2134- 单选错位
- BZOJ_2134_单选错位——期望DP
- BZOJ 2134 单选错位 ——期望DP
- BZOJ 2134: 单选错位( 期望 )
- BZOJ2134 单选错位