codeforces 235 B. Let's Play Osu!】的更多相关文章

You're playing a game called Osu! Here's a simplified version of it. There are n clicks in a game. For each click there are two outcomes: correct or bad. Let us denote correct as "O", bad as "X", then the whole play can be encoded as a…
[codeforces 235]A. LCM Challenge 试题描述 Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it. But I also don't want to use many numbers, so I'll choose three…
cf235B 一道有意思的题.(据说是美少女(伪)计算机科学家出的,hh) 根据题目要求,就是求ni^2的和. 而n^2=n*(n-1)+n; n*(n-1)=C(n,2)*2: 所以∑ai^2=∑ai+2*∑C(n,2) 化为求连续长度大于2的序列个数:这样好像还是不太好直接做 设dp[i]=以i结尾的期望长度: dp[0]=dp[1]=0,dp[2]=p1p2,dp[3]=p1p2p3+p2p3=(dp[2]+p[2])*p3  ... 得dp[i]=p[i]*(dp[i-1]+p[i-1]…
\(\\\) \(Description\) 一共进行\(N\)次操作,生成一个长度为\(N\)的\(01\)序列,成功对应\(1\),失败对应\(0\),已知每一次操作的成功率\(p_i\). 在这个序列中连续且极长的\(X\)个\(1\)可以贡献\(X^2\)的分数,求期望总分. \(N\in [1,10^5]\) \(\\\) \(Solution\) 考虑增量的思路很可以啊.长度平方的期望并不等于期望长度的平方.所以需要直接考虑长度平方的期望变化. 当长度从\(X\)增加到\(X+1\)…
[题目链接]:http://codeforces.com/problemset/problem/235/B [题意] 让你玩一个游戏,游戏结果由一个长度为n的01字符组成; 这个结果的分数与连续的1的个数对应; 对于每一个"1"的连续块,假设长度为L; 为0的部分不计分 则总分加上L 2   然后告诉你每个位置有p[i]的可能性为1;1-p[i]的可能性为0; 问你最后的期望得分是多少; [题解] 这个规则能够写成另外一种形式; 1. 如果两个1所在的位置为i和j; 且i和j之间没有0…
题目:http://codeforces.com/contest/401/problem/C 题意:n个0,m个1,求没有00或111的情况. 这么简单的题..... 做题的时候脑残了...,今天,贴一下ac的代码,警示一下自己 #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespa…
题目链接:点击打开链接 给定n表示有n个格子 以下每一个格子为O的概率是多少. 对于一段连续 x 个O的价值就是 x*x ; 问: 获得的价值的期望是多少. 思路: 把公式拆一下.. #include <cstdio> const int N = 100005; double dp[N][2], p[N]; int main(){ int n; scanf("%d", &n); for(int i = 1; i <= n; i ++) { scanf(&quo…
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds. Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders).…
Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each card doesn't exceed x in the a…
Discription Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum: Find the sum modulo 1073741824 (230). Input The first line contains three space-sep…