Codeforces 235 C】的更多相关文章

[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…
题目: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…
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…
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…
题目大意 给定一个模板串, 再给出\(n\)个询问, 询问每一个串的循环串总共在原串中出现了多少次. 循环串: 比如说有\(str[] = \{ABCD\}\), 则其循环串有\(\{ABCD\}, \{BCDA\}, \{CDAB\}, \{DABC\}\), 共\(len\)个. 题解 把每一个串复制一遍放在原串后面: \(\{ABCD\} \to \{ABCDABC\}\), 放入原串的后缀自动机中匹配. 在匹配时, 假如下一位无法匹配, 则跳suffix link; 假如即使跳了suff…
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/401/D D. Roman and Numbers time limit per test4 secondsmemory limit per test512 megabytes 问题描述 Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sere…