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

2014年4月30日

POJ 2249

摘要: #includelonglong sum;int main(){int k,n,m;while(~scanf("%d%d",&n,&m)&&(n!=0||m!=0)){sum =1;m = m<(n-m)?m:n-m;for(k =1;k <= m;k++)sum =(sum*(n-m+k))/k;... 阅读全文

posted @ 2014-04-30 18:34 ~Love() 阅读(82) 评论(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() 阅读(84) 评论(0) 推荐(0)

POJ 2406

摘要: 思路:由于题目要求的是最大值,因此从n开始向下查找,第一次出现的满足条件的那个数就是最大的,查找就可以结束,如果查找到1是仍未找到合适的值,则为1,就是说不是任何字符串的次方如abcd#include#include#define N 1000001int str_judge(int n,int i... 阅读全文

posted @ 2014-04-30 18:34 ~Love() 阅读(82) 评论(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() 阅读(105) 评论(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() 阅读(228) 评论(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() 阅读(272) 评论(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() 阅读(250) 评论(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() 阅读(358) 评论(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() 阅读(230) 评论(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() 阅读(143) 评论(0) 推荐(0)

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

导航