上一页 1 ··· 60 61 62 63 64 65 66 67 68 ··· 71 下一页
摘要: 参考着cz的写的判重问题 :保存每一层的找过的节点 再在这一层找的时候 要保证与之前没有相同的View Code 1 #include<stdio.h> 2 #include<string.h> 3 long count,f[11],s,x[11],a[11]; 4 void dfs(long v) 5 { 6 long j,flag = 0,g,w,q[11]; 7 if(v>9) 8 { 9 if(x[1]+x[2]+x[3]==x[4]+x[5]+x[6]&&x[4]+x[5]+x[6]==x[7]+x[8]+x[9]&&x[ 阅读全文
posted @ 2012-07-18 10:49 _雨 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 以前貌似做过这个题 WA2次 一次因为复制输出的时候 把8复制上去了 还有理解错了 以为小于等于1的时候要去S呢View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int n, m, t, i, j, k,num,a[12][12],x,y,count1,count2; 6 char c[11][11]; 7 while(scanf("%d%d%d%*c", &n, &m, &t)&&n&&m&&am 阅读全文
posted @ 2012-07-15 21:29 _雨 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题目描写的乱七八糟 就是找无论顺序大小写 不重复出现的字符串 按字典序输出http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=92代码乱七八糟的写的真长View Code 1 #include <stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 typedef struct node 5 { 6 char c[25]; 7 int x; 8 } 阅读全文
posted @ 2012-07-13 23:27 _雨 阅读(332) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include <stdio.h> 2 #include<math.h> 3 int tr(int x,int y,int z) 4 { 5 if(x+y>z&&y+z>x&&x+z>y&&abs(x-y)<z&&abs(y-z)<x&&abs(x-z)<y) 6 return 1; 7 else 8 return 0; 9 }10 int tq(int x,int y,int z)11 {12 if(x == 0||y==0|| 阅读全文
posted @ 2012-07-13 14:10 _雨 阅读(533) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1242刚开始由于 没标记已走过的 导致RE TLE 纠结了好久 同样纠结为什么正着搜就WAView Code 1 #include <stdio.h> 2 #include<string.h> 3 int n, m,p = 0,q = 0; 4 char c[201][201]; 5 typedef struct queue 6 { 7 int num, x, y; 8 }st; 9 st Q[100001];10 void inque(int a, int b)11 {12 q++; 阅读全文
posted @ 2012-07-12 23:38 _雨 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 看了看题 没什么想法 参考着解题报告写的状态方程 dp[i][j] = max{dp[i+1][j],dp[i+1][j+1],dp[i+1][j-1]}View Code 1 #include <stdio.h> 2 #include<string.h> 3 int dp[100001][12]; 4 int max1(int x, int y, int z) 5 { 6 int m = x; 7 if(m<y) 8 m = y; 9 if(m<z)10 m = z;11 return m;12 }13 int main()14 {15 ... 阅读全文
posted @ 2012-07-12 21:32 _雨 阅读(217) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1321由于忘记取消起点那里的标记 WA了一次 有点类似皇后View Code 1 #include <stdio.h> 2 #include<string.h> 3 int n, m,count,x[11],y[11]; 4 char c[10][10]; 5 void dfs(int i, int j, int v) 6 { 7 int p,q; 8 if(v == m) 9 count++;10 else11 {12 for(p = i+1 ; p <= n ; p++)13 ... 阅读全文
posted @ 2012-07-12 16:59 _雨 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 这题主要是重复问题怎么删除 由于是排好序的 有重复的 肯定是相邻的在同一层上的结点值 保证不相同就行 不同层可以相同 比如 4 = 2+1+1 可以有两个1具体看代码View Code 1 #include <stdio.h> 2 #include<string.h> 3 int a[1001],n,s,v,y,flag,num[1001],ch; 4 void dfs(int x, int i,int v) 5 { 6 int j,k; 7 y+= x; 8 num[v] = x; 9 if(y == s)10 {11 for... 阅读全文
posted @ 2012-07-12 15:37 _雨 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 转自http://hi.baidu.com/zhangwp999/blog/item/185f9afba454ba63024f5675.html*六类qsort排序方法P.S.:qsort函数是ANSI C标准中提供的,其声明在stdlib.h文件中,是根据二分发写的,其时间复杂度为n*log(n),其结构为:void qsort(void *base,size_t nelem,size_t width,int (*Comp)(const void *,const void *));其中:*base 为要排序的数组nelem 为要排序的数组的长度width 为数组元素的大小(一字结为单位)(* 阅读全文
posted @ 2012-07-11 23:01 _雨 阅读(334) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1415水题 简单排序查找 快排+哈希View Code 1 #include <stdio.h> 2 #include<string.h> 3 int cmp(const void*a,const void *b) 4 { 5 return *(int *)a-*(int *)b; 6 } 7 int main() 8 { 9 int i,j,n, m, a 阅读全文
posted @ 2012-07-11 22:20 _雨 阅读(182) 评论(0) 推荐(0) 编辑
上一页 1 ··· 60 61 62 63 64 65 66 67 68 ··· 71 下一页