摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1010 dfs+奇偶性剪枝 #include<iostream>using namespace std;char gra[8][8];bool mark[8][8]; int dir[4][2]={-1,0,1,0,0,-1,0,1},m,n,t,ok,si,sj,ei,ej;int fun(int a... 阅读全文
posted @ 2012-08-29 16:11 Yogurt Shen 阅读(158) 评论(0) 推荐(0) 编辑
摘要: http://lightoj.com/volume_showproblem.php?problem=1012 有木有发现和之前一道是一样的- -# #include<cstdio>#include<iostream>#include<cstring>using namespace std;bool map[21][21];int cnt,w,h;void dfs(int x,int y)... 阅读全文
posted @ 2012-08-29 15:59 Yogurt Shen 阅读(269) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2488 和之前的都是一系列- -# #include <stdio.h>#include <stdlib.h>#define MAX 27int map[MAX][MAX],sx[MAX],sy[MAX];int dir[8][2]={-2,-1,-2,1,-1,-2,-1,2,1,-2,1,2,2,-1,2,1},p,q,sign,... 阅读全文
posted @ 2012-08-29 15:43 Yogurt Shen 阅读(139) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2243 最简单的bfs输出下路径 #include<stdio.h>#include<string.h>struct{ int x,y,step;} queue[10000],e;bool mark[10][10];int dir[8][2]= {2,1,1,2,-1,2,-2,1,-2,-1,-1,-2,1,-2,2,-1},... 阅读全文
posted @ 2012-08-29 15:39 Yogurt Shen 阅读(181) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2251 bfs三维的,见代码注释。 #include<iostream>#include<cstring>#include<queue>using namespace std;bool hash[35][35][35];char map[35][35][35];struct prog{ int x,y,z,step;}start... 阅读全文
posted @ 2012-08-29 15:31 Yogurt Shen 阅读(174) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2245 dfs入门题 #include<cstdio>#include<cstring>int rec[100],num[100],n;void dfs(int dep,int cur){ if(dep==6) { for(int i=0;i<5;i++) printf("%d ",... 阅读全文
posted @ 2012-08-29 15:23 Yogurt Shen 阅读(115) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1000 午饭前几秒无良一下哈哈哈 #include<iostream>using namespace std;int main(void){ int a,b; cin>>a>>b; cout<<a+b<<endl; return 0;} 阅读全文
posted @ 2012-08-29 12:37 Yogurt Shen 阅读(117) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1002 方法好理解好写。。。 #include<stdio.h>#include<string.h>#include<stdlib.h>#include<ctype.h>char pn[100000][8];int main(void){ int i,j,n,c,mark=1; scanf("%d",&n); for... 阅读全文
posted @ 2012-08-29 12:32 Yogurt Shen 阅读(184) 评论(0) 推荐(0) 编辑
摘要: http://acmpj.zstu.edu.cn/JudgeOnline/showproblem?problem_id=3795 淫荡的大圆旁边很小圆。。。 #include<stdio.h>#include<stdlib.h>#include<math.h>#define len 10double radius[len],r[len],x[len],min;int n;int cmp(... 阅读全文
posted @ 2012-08-29 12:28 Yogurt Shen 阅读(179) 评论(0) 推荐(0) 编辑
摘要: http://acmpj.zstu.edu.cn/JudgeOnline/showproblem?problem_id=3794 大数的素数判断很吊的样子,现在这里记录一下吧- -当初水过去了。。。 #include<iostream>#include<ctime>using namespace std;long long factor[100],fac_top=-1;long long... 阅读全文
posted @ 2012-08-29 12:25 Yogurt Shen 阅读(171) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2385 当初也是看了别人的解题报告- -#。。。 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int dp[1001][31],num[1001];int main(void){ int T,W,i,j; while(sca... 阅读全文
posted @ 2012-08-29 12:18 Yogurt Shen 阅读(182) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1003 当初竟然没用DP- -。。。 #include<stdio.h>#define N 100100int a[N];int main(void){ int i,j,n,t,cas,begin,end,s,sum,Max; while(scanf("%d",&t)!=EOF) { ... 阅读全文
posted @ 2012-08-29 12:16 Yogurt Shen 阅读(118) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3018DP版本#include<cstdio>#include<cstring>#include<algorithm>#define INF 100000000;using namespace std; int box[510][1010],map[510][510],dp[510],n,d,count=0;bool ok; bool solve(int a,int b){ int i,j; bool flag=true; for(i=1;i<=d;i++) { if(box[a][i]>=b 阅读全文
posted @ 2012-08-29 12:11 Yogurt Shen 阅读(173) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1745 #include<stdio.h>#include<string.h>int a[10001],n,m;bool dp[10001][101];int main(void){ int i,j,t1,t2; scanf("%d%d",&n,&m); for(i=1;i<=n;i++) { sc... 阅读全文
posted @ 2012-08-29 12:05 Yogurt Shen 阅读(238) 评论(0) 推荐(0) 编辑
摘要: http://acmpj.zstu.edu.cn/JudgeOnline/showproblem?problem_id=1362 经典DP教学专用。。。 #include<cstdio>#include<cstring>#include<algorithm>#define MAXN 102using namespace std;int dp[MAXN][MAXN],a[MAXN][MAX... 阅读全文
posted @ 2012-08-29 12:03 Yogurt Shen 阅读(259) 评论(0) 推荐(0) 编辑
摘要: http://acmpj.zstu.edu.cn/JudgeOnline/showproblem?problem_id=2545 呵呵。。。呵呵。。。呵呵。。。 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int main(void){ int n,m,i,j,k,g,dp[120]... 阅读全文
posted @ 2012-08-29 11:59 Yogurt Shen 阅读(324) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2559 当初写出来老高兴了呢。。。 #include<cstdio>#define N 100001using namespace std;int l[N],r[N],h[N];int main(void){ int n,i; while(scanf("%d",&n),n) { for(i=1;i<=n... 阅读全文
posted @ 2012-08-29 11:55 Yogurt Shen 阅读(173) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1458 挫挫更健康。。。 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int dp[1000][1000];int main(void){ char a[1000],b[1000]; int n,m,i,j; mems... 阅读全文
posted @ 2012-08-29 11:53 Yogurt Shen 阅读(101) 评论(0) 推荐(0) 编辑
摘要: http://acmpj.zstu.edu.cn/JudgeOnline/showproblem?problem_id=2548 这不是什么高效算法,不过好理解,现在看看好二啊。。。 #include<stdio.h>int n,num[1001],dp[1001];int main(void){ int i,j,ans; while(scanf("%d",&n)!=EOF)... 阅读全文
posted @ 2012-08-29 11:50 Yogurt Shen 阅读(142) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1176 当初DP第一题,写的太挫了,不高兴改了- -# #include<stdio.h>#include<string.h>#define maxer(a,b) ((a)>(b)?(a):(b))int dp[100001][12];int max(int a,int b,int c){ ret... 阅读全文
posted @ 2012-08-29 11:46 Yogurt Shen 阅读(127) 评论(0) 推荐(0) 编辑