POJ 1775 (ZOJ 2358) Sum of Factorials】的更多相关文章

Description John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathematics, logic, quantum physics,meteorology, science, computers, and game theory. He wa…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1094 ZOJ Problem Set - 1094 Matrix Chain Multiplication -------------------------------------------------------------------------------- Time Limit: 2 Seconds Memory Limit: 65536 KB -------…
Description A boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4 x 4 matrix which has the parity property: 1 0 1 0 0 0 0 0 1 1 1 1 0 1 0 1 The sums of t…
两题二分图匹配的题: 1.一个农民有n头牛和m个畜栏,对于每个畜栏,每头牛有不同喜好,有的想去,有的不想,对于给定的喜好表,你需要求出最大可以满足多少头牛的需求. 2.给你学生数和课程数,以及学生上的课,如果可以做到每个学生代表不同的课程并且所有的课程都被代表输出"YES"(学生能代表一门课当且仅当他上过). 1.POJ 1274 The Perfect Stall http://poj.org/problem?id=1274 和上一题过山车一样,也是二分图匹配的. 水题. #incl…
链接:http://poj.org/problem?id=3122 Pie Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10448   Accepted: 3694   Special Judge Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N…
| 1 2 3 4 5 6 | | 3 6 5 1 4 2 | 在一个置换下,x1->x2,x2->x3,...,xn->x1, 每一个置换都可以唯一的分解为若干个不交的循环 如上面那个  可以 =>(1,3,5,4)  1的下面是3  :3的下面是5 一直循环.   (2,6) 一个循环,有两种处理方法: ①用这个循环中最小的元素,依次与相应元素交换,直到该循环内所有元素归位 ②用这个循环中最小的元素与所有数中最小的元素交换,然后用所有数中最小的元素依次与相应元素交换,直到该循环…
###POJ 3252 题目链接 ### 题目大意:给你一段区间 [Start,Finish] ,在这段区间中有多少个数的二进制表示下,0 的个数 大于等于 1 的个数. 分析: 1.很显然是数位DP,枚举这区间中所有数的二进制位数.由于与 0 的个数有关,故需要用 lead 标记前导零情况. 2.然后就是要处理 1 的个数与 0 的个数,故 dp 的第二维状态即要表示出枚举到当前位 pos 时所拥有的 0 的个数 (或 1). 但是你会发现,如果当前知道的是 前面几位中 0 的个数,为了满足题…
链接:http://poj.org/problem?id=3335     //大牛们常说的测模板题 ---------------------------------------------------------------- Rotating Scoreboard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5158   Accepted: 2061 Description This year, ACM/ICPC…
Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901). Input The only line contains the two natural numbers A and B, (0 <= A,B <= 50000000)separated by…
题意:一条路上有n个地雷,给出地雷的位置.某人从起点(位置1)出发,走一步的概率是p,走两步的概率是(1-p),然后问有多少概率走过这个雷区. 思路: 只要走过最后一个地雷就代表走过雷区了. 而每到 i 这个地方,无非是前一步和前两步走过来的.那么公式就是dp[ i ]= p*dp[ i-1 ]+dp[ i-2]*(1-p) 这是连续没有地雷的区域的走法.那么有地雷呢? 把有红圈的表示地雷.那么像图上进行分段,将上一段不踩雷的概率就可以当做下一段的开始的概率. 则 dp[ a[i] +1] =…