POJ 2409 Let it Bead(polya裸题)
摘要:题目传送:http://poj.org/problem?id=2409 Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from t
阅读全文
HDU 4704 Sum(隔板原理+组合数求和公式+费马小定理+快速幂)
摘要:题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=4704 Problem Description Sample Input 2 2 Sample Output 2 Hint 1. For N = 2, S(1) = S(2) = 1. 2. The in
阅读全文
快速幂
摘要:long long quickmod(long long a,long long b,long long m) { long long ans = 1; while(b)//用一个循环从右到左遍历b的所有二进制位 { if(b&1)//判断此时b[i]的二进制位是否为1 { ans = (...
阅读全文
HDU 1588 Gauss Fibonacci(矩阵快速幂)
摘要:Gauss Fibonacci Gauss Fibonacci Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 27 Accepted Submi
阅读全文