传送门:点我 A. Lengthening Sticks  time limit per test        1 second You are given three sticks with positive integer lengths of a, b, and c centimeters. You can increase length of some of them by some positive integer number of centimeters (different s…
2015 asia xian regional F Color (容斥 + 组合数学) 题目链接http://codeforces.com/gym/100548/attachments Description Recently, Mr. Bigrecieved n flowers from his fans. He wants to recolor those flowerswith m colors. The flowers are put in a line. It is not allow…
Lengthening Sticks Problem's Link: http://codeforces.com/contest/571/problem/A Mean: 给出a,b,c,l,要求a+x,b+y,c+z构成三角形,x+y+z<=l,成立的x,y,z有多少种. analyse: 这题在推公式的时候细心一点就没问题了. 基本的思路是容斥:ans=所有的组合情况-不满足条件的情况. 1.求所有的组合情况 方法是找规律: 首先只考虑l全部都用掉的情况. l=1:3 l=2:6 l=3:10…
C. Mike and Foam time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are n kinds of beer at Rico's…
C. Lengthening Sticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given three sticks with positive integer lengths of a, b, and c centimeters. You can increase length of some of…
Description 一个有N个元素的集合有2^N个不同子集(包含空集),现在要在这2^N个集合中取出若干集合(至少一个),使得它们的交集的元素个数为K,求取法的方案数,答案模1000000007.(是质数喔~) Input 一行两个整数N,K Output 一行为答案. Sample Input 3 2 Sample Output 6 HINT [样例说明] 假设原集合为{A,B,C} 则满足条件的方案为:{AB,ABC},{AC,ABC},{BC,ABC},{AB},{AC},{BC} […
[BZOJ4559][JLoi2016]成绩比较 Description G系共有n位同学,M门必修课.这N位同学的编号为0到N-1的整数,其中B神的编号为0号.这M门必修课编号为0到M-1的整数.一位同学在必修课上可以获得的分数是1到Ui中的一个整数.如果在每门课上A获得的成绩均小于等于B获得的成绩,则称A被B碾压.在B神的说法中,G系共有K位同学被他碾压(不包括他自己),而其他N-K-1位同学则没有被他碾压.D神查到了B神每门必修课的排名.这里的排名是指:如果B神某门课的排名为R,则表示有且…
Problem F. ColorDescriptionRecently, Mr. Big recieved n flowers from his fans. He wants to recolor those flowers withm colors. The flowers are put in a line. It is not allowed to color any adjacent flowers withthe same color. Flowers i and i + 1 are said…
这题七次方做法显然,但由于我太菜了,想了一会发现也就只会这么多,而且别的毫无头绪.发现直接做不行,那么,容斥! f[i]为至少i个极值的方案,然后这里需要一些辅助变量,a[i]表示选出i个三维坐标均不相同的i个极大值的方案数,g[i]表示i个极大的数任意一个至少有一维坐标相同的点的个数,h[i]表示g[i]的极值可以同时存在的方案数,那么有f[i]=C(nml,g[i])a[i]h[i](nml-g[i])!. a[i]很容易求得,就是(∏(n-j)(m-j)(l-j))/i!,其中j∈[0,i…
正题 题目链接:http://www.51nod.com/Challenge/Problem.html#problemId=1667 题目大意 两个人. 第一个人有\(k_1\)个集合,第\(i\)个包括了范围\([L1_i,R1_i]\)的整数. 第二个人有\(k_2\)个集合,第\(i\)个包括了范围\([L2_i,R2_i]\)的整数. 现在两个人分别从各个集合中取出一个数字然后求和. 求第一个人大于/等于/小于第二个人的概率. \(1\leq T\leq 5,\leq k_1,k_2\l…