2011年8月11日

sum it up hdu 1258

摘要: Sum It UpTime Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 1Accepted Submission(s) : 1Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem DescriptionGiven a specified total t and a list of n integers, find all distinct sums using numbers fr 阅读全文

posted @ 2011-08-11 20:20 more think, more gains 阅读(219) 评论(0) 推荐(0) 编辑

Accepted Necklace hdu 2660

摘要: Accepted NecklaceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1022Accepted Submission(s): 406Problem DescriptionI have N precious stones, and plan to use K of them to make a necklace for my mother, but she won't accept a necklace which is to 阅读全文

posted @ 2011-08-11 18:59 more think, more gains 阅读(263) 评论(0) 推荐(0) 编辑

递归 DFS

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>int sum = 0;char ch[3] = {'L', 'R','P'};void DFS(int x, int n, int t ){ int i; if (n == t) { sum += x; return ; } for (i = 0; i < 3; i++) if( ch[i] == 'L') DFS(2 * x , n + 1, t); else if ( ch 阅读全文

posted @ 2011-08-11 17:02 more think, more gains 阅读(208) 评论(0) 推荐(0) 编辑

连连看 hdu 1175

摘要: 这题刚开始时一直TLE,后来改了之后,一直wa,,重写一遍就过了。。至今不知道原来错在哪里。。郁闷啊。。#include <stdio.h>#include <stdlib.h>#include <string.h>#include <queue>using namespace std;int N, M, T, x1, x2, y1, y2;int map[1010][1010];int mark[1010][1010];const int inf = 0x7f7f7f7f;void debug( ){ #ifdef P freopen(&quo 阅读全文

posted @ 2011-08-11 17:00 more think, more gains 阅读(150) 评论(0) 推荐(0) 编辑

递归 生成全排列

摘要: #include <stdio.h>#include <string.h>int a[20], N;void fun(int n, int r){ int i, j, flag; if( r == n) { for(i = 0; i < n; i++) printf("%d ",a[i]); puts(""); return ; } else { for (i = 1; i <= n; i++) { flag = 1; for(j = 0; j < r; j++) if ( i == a[j] ) flag = 阅读全文

posted @ 2011-08-11 16:58 more think, more gains 阅读(142) 评论(0) 推荐(0) 编辑

导航