HDU5187 zhx's contest(计数问题)】的更多相关文章

主题链接: http://acm.hdu.edu.cn/showproblem.php?pid=5187 题意: 从1~n,有多少种排列 使得 a1~ai 满足单调递增或者单调递减. ai~an 满足单调递增或者递减. 非常明显的组合问题 从n个数种选出i个数 剩下的数要满足单调递增或者递减或者递减的规律那么方式唯一 ans = (C(N,0)+C(N,1)+......+C(N,N)) =2^N; 可是这样的情况下 单调递增和单调递减算了两遍  因此要减2 ans = 2^n - 2; 注意n…
zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 448    Accepted Submission(s): 147 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n p…
Problem Description As one of the most powerful brushes, zhx is required to give his juniors n problems. zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a beautiful way. zhx defines a sequence {ai} beautiful if the…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2388    Accepted Submission(s): 755 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n problems.zhx t…
Andrew Stankevich's Contest (1) 打一半出门了,回来才补完了...各种大数又不能上java..也是蛋疼无比 A:依据置换循环节非常easy得出要gcd(x, n) = 1而且x <= n / 2,那么把相应几种情况的最大值考虑一下就可以,各自是n % 2 = 1为n / 2, n % 4 = 0为n / 2 - 1,n % 4 = 2为n / 2 - 2 B:限制下限的最大流,建模方法为原来容量变成c - l,然后源点连到每一个点的下限和为正,每一个点下限和为负连到…
zhx's submissions Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 540    Accepted Submission(s): 146 Problem Description As one of the most powerful brushes, zhx submits a lot of code on many o…
Problem Description As one of the most powerful brushes, zhx submits a lot of code on many oj and most of them got AC. One day, zhx wants to count how many submissions he made on n ojs. He knows that on the ith oj, he made ai submissions. And what yo…
Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 661    Accepted Submission(s): 363 Problem Description On birthday, Anthony got a toy. It is constructed with N+1(N>=3) balls and 2*N sticks. All…
[问题描述] 作为史上最强的刷子之一,zhx的老师让他给学弟(mei)们出n道题.zhx认为第i道题的难度就是i.他想要让这些题目排列起来很漂亮. zhx认为一个漂亮的序列{ai}下列两个条件均需满足. 1:a1..ai是单调递减或者单调递增的. 2:ai..an是单调递减或者单调递增的. 他想你告诉他有多少种排列是漂亮的.因为答案很大,所以只需要输出答案模p之后的值. [题解] 对于整段序列单调增或减,就2种情况. 对于先增后减或先减后增:确定一个序列中的最小值(最大值),其他的要么在左边,要…
zhx and contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 324    Accepted Submission(s): 118 Problem Description As one of the most powerful brushes in the world, zhx usually takes part i…