hdu 5187 zhx's contest】的更多相关文章

传送门 zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 575    Accepted Submission(s): 181 Problem Description As one of the most powerful brushes, zhx is required to give his juniors…
zhx's contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3835    Accepted Submission(s): 1255 Problem Description As one of the most powerful brushes, zhx is required to give his juniors n…
题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5187 bc(中文): http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=571&pid=1002 题解: 求(2^n-2)%p,题目看错,一天都没什么思路,冷静一下.. 代码: #include<iostream> #include<cstring> #include<cst…
作为史上最强的刷子之一,zhx的老师让他给学弟(mei)们出n道题.zhx认为第i道题的难度就是i.他想要让这些题目排列起来很漂亮. zhx认为一个漂亮的序列{ai}下列两个条件均需满足. 1:a1..ai是单调递减或者单调递增的. 2:ai..an是单调递减或者单调递增的. 他想你告诉他有多少种排列是漂亮的.因为答案很大,所以只需要输出答案模p之后的值. Input Multiply test cases(less than 10001000). Seek EOF as the end of…
题目分析如果n=1,答案是1,否则答案是2n−2. 证明:ai肯定是最小的或者最大的.考虑另外的数,如果它们的位置定了的话,那么整个序列是唯一的. 那么ai是最小或者最大分别有2n−1种情况,而整个序列单调增或者单调减的情况被算了2次,所以要减2. 要注意的一点是因为p>231,所以要用快速乘法.用法与快速幂相同.如果直接乘会超过long long范围,从而wa掉. 快速幂+快速乘法 #include<cstdio>#include<cstring>#include<c…
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…
传送门 zhx and contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 145    Accepted Submission(s): 49 Problem Description As one of the most powerful brushes in the world, zhx usually takes part…
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…
Problem Description As one of the most powerful brushes in the world, zhx usually takes part in all kinds of contests. One day, zhx takes part in an contest. He found the contest very easy for him. There are n problems in the contest. He knows that h…
http://acm.hdu.edu.cn/showproblem.php?pid=5187 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 wa…