上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 25 下一页

2014年4月30日

HDU 1953

摘要: #include#includelong long int euler(long long int n){long long int i,m = (int)sqrt(n+0.5),ans = n;for(i = 2;i 1)ans = ans*(n-1)/n;return ans;}long lon... 阅读全文

posted @ 2014-04-30 18:34 ~Love() 阅读(110) 评论(0) 推荐(0)

HDU 2191

摘要: 思路:简单动态规划,多重背包转化成0 1背包问题#include#includeint a[101][2001],rcw[2001],rcp[2001];int max(int x,int y){ return x>y?x:y;}int main(){ int C,i,j,k,pg,n,... 阅读全文

posted @ 2014-04-30 18:34 ~Love() 阅读(80) 评论(0) 推荐(0)

HDU 1028

摘要: 思路:一开始拿到这个题目以为是找规律,有递推关系什么的,最后找了好长时间没找到规律,上网查了一下才发现是用母函数做,就是把数的加法和指数乘法的幂的加法联系起来,母函数:G(x)=(1+x+x^2+x^3+x^4+.....)*(1+x^2+x^4+x^6+....)*(1+x^3+x^6+x^9+.... 阅读全文

posted @ 2014-04-30 18:34 ~Love() 阅读(134) 评论(0) 推荐(0)

HDU 1272

摘要: 并查集的应用注意是“有且仅有”就要保证最终只有一个集合,且每个点都只有一条路。#includeint father[100005],depth[100005];int a[200005];void init(){ int i; for(i = 1; i depth[y]) ... 阅读全文

posted @ 2014-04-30 18:33 ~Love() 阅读(102) 评论(0) 推荐(0)

2014年4月25日

POJ -- 3842

摘要: An Industrial SpyDescriptionIndustrial spying is very common for modern research labs. I am such an industrial spy - don't tell anybody! My recent job... 阅读全文

posted @ 2014-04-25 19:26 ~Love() 阅读(225) 评论(0) 推荐(0)

POJ -- 3233 求“等比矩阵”前n(n <=10^9)项和

摘要: Matrix Power SeriesDescriptionGiven an×nmatrixAand a positive integerk, find the sumS=A+A2+A3+ … +Ak.InputThe input contains exactly one test case. Th... 阅读全文

posted @ 2014-04-25 17:42 ~Love() 阅读(269) 评论(0) 推荐(0)

POJ ---3070 (矩阵乘法求Fibonacci 数列)

摘要: FibonacciDescriptionIn the Fibonacci integer sequence,F0= 0,F1= 1, andFn=Fn− 1+Fn− 2forn≥ 2. For example, the first ten terms of the Fibonacci sequenc... 阅读全文

posted @ 2014-04-25 13:05 ~Love() 阅读(247) 评论(0) 推荐(0)

POJ --- 3613 (K步最短路+矩阵快速幂+floyd)

摘要: Cow RelaysDescriptionFor their physical fitness program,N(2 ≤N≤ 1,000,000) cows have decided to run a relay race using theT(2 ≤T≤ 100) cow trails thro... 阅读全文

posted @ 2014-04-25 12:33 ~Love() 阅读(354) 评论(0) 推荐(0)

2014年4月24日

POJ --- 2918 求解数独

摘要: TudokuDescriptionTom is a master in several mathematical-theoretical disciplines. He recently founded a research-lab at our university and teaches new... 阅读全文

posted @ 2014-04-24 17:25 ~Love() 阅读(227) 评论(0) 推荐(0)

POJ --- 3740

摘要: Easy FindingDescriptionGiven aM×NmatrixA.Aij∈ {0, 1} (0 ≤ i 16)的每个二进制位来表示每列状态,比如某列的第二行有个1,则int型数字里面第二个二进制位就为1,时间复杂度2^16*m,可以接受。这里存在一个问题就是怎么通过每列的状态(一个i... 阅读全文

posted @ 2014-04-24 12:02 ~Love() 阅读(138) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 25 下一页

导航