摘要: http://poj.org/problem?id=2240 之前看了红皮写的 #include<iostream>#include<cstdio>#include<cstring>using namespace std;const int MAXN=50;const int MAXL=1005;char str[MAXN][MAXL],strA[MAXL],strB[MAXL];lon... 阅读全文
posted @ 2012-08-30 18:26 Yogurt Shen 阅读(151) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3166 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 102int map[N][N],hot[N],n,min,c;void floyd(){ int i,j,k,t; ... 阅读全文
posted @ 2012-08-30 18:23 Yogurt Shen 阅读(221) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1860 好像当初百度了一下来着- -# #include<stdio.h>#include<string.h>int N,M,S,cnt;double V;struct edge{ int u,v; double r,c;}E[201];int bellman(){ int i, f; double d[110... 阅读全文
posted @ 2012-08-30 18:19 Yogurt Shen 阅读(132) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1502 #include<stdio.h>#include<string.h>#include<stdlib.h>#define INF 0xffffff#define N 110int map[N][N],vis[N],dis[N],n,min;void dijkstra(int x){ int i,j,k; memset(v... 阅读全文
posted @ 2012-08-30 18:14 Yogurt Shen 阅读(131) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1125 暴力下 #include<stdio.h>#define INF 0xfffffff#define N 200int map[N][N],t[N],n,min;void floyd(){ int i,j,k; for(k=1;k<=n;k++) for(i=1;i<=n;i++) fo... 阅读全文
posted @ 2012-08-30 18:11 Yogurt Shen 阅读(215) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2680 都是些入门的套套模版 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 1002int map[N][N],dis[N],vis[N],n,m,min;void dijkstra(int s){ int i,... 阅读全文
posted @ 2012-08-30 18:09 Yogurt Shen 阅读(113) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1874 简单 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 600int map[N][N],dis[N],vis[N],n,m,min;void dijkstra(int s,int t){ int i,j,k... 阅读全文
posted @ 2012-08-30 18:07 Yogurt Shen 阅读(134) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2112 字符串处理下,以前不会用find函数就自写了个 - -。。。 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 600int map[N][N],vis[N],dis[N],m,min;char name[N... 阅读全文
posted @ 2012-08-30 18:04 Yogurt Shen 阅读(134) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2544 最短路径第一题 #include<stdio.h>#include<string.h>#define INF 0xfffffff#define N 600int map[N][N],vis[N],dis[N],n,m,min;void dijkstra(){ int i,j,k; m... 阅读全文
posted @ 2012-08-30 18:00 Yogurt Shen 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑
摘要: http://poj.org/problem?id=2864 横从坐标别弄反了- -#好像用位运算&更给力,写出来了的话再放上来吧。 #include<stdio.h>int main(void){ int a[510][110],N,D,i,j,flag; while(scanf("%d%d",&N,&D),N||D) { for(i=1;i<=D... 阅读全文
posted @ 2012-08-29 11:36 Yogurt Shen 阅读(140) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1207 注意输入两个数的大小,水。。。 #include <stdio.h>int main(void){ int a,b,m,count,i,max; while(scanf("%d%d",&a,&b)!=EOF) { printf("%d %d ",a,b); if(a>b){m=a;... 阅读全文
posted @ 2012-08-29 11:03 Yogurt Shen 阅读(110) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1338写写水题放松放松- -##include<iostream>#include<queue>using namespace std;typedef pair<unsigned long,int>node_type;int main(void){ unsigned long result[1500]; priority_queue<node_type,vector<node_type>,greater<node_type> >Q; Q.push(make_pair(1 阅读全文
posted @ 2012-08-29 10:55 Yogurt Shen 阅读(280) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2351 烦烦更健康。。。 #include<stdio.h>#include<string.h>char *x[]={"WET","0","UTC","0","GMT","0","BST","+1","IST","+1","WEST","+1","CET",&q 阅读全文
posted @ 2012-08-28 23:22 Yogurt Shen 阅读(372) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1008 奇葩的名字输入蛋疼。。。 #include<stdio.h>#include<string.h>char *haabm[]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh&quo 阅读全文
posted @ 2012-08-28 23:18 Yogurt Shen 阅读(140) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3080 最长公共子串,感觉自己写的不错~ #include<stdio.h>#include<string.h>const int maxm=10+2;const int maxs=60+2;int main(void){ int loop,m,len,i,j,k; char p[maxm][maxs],ans[maxs]... 阅读全文
posted @ 2012-08-28 23:11 Yogurt Shen 阅读(151) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1488 它逗你玩儿- -# #include<stdio.h>int main(void){ int c,q=1; while((c= getchar())!=-1) { if(c=='"') { printf("%s",q?"``":"''"); ... 阅读全文
posted @ 2012-08-28 23:04 Yogurt Shen 阅读(128) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2246 矩阵相乘,不明白方法的同学去看一下线性代数~~~ #include<stdio.h>typedef struct{ int mults,rows,cols;}triple;int rows[256],cols[256],p;char e[100],error; triple expressio... 阅读全文
posted @ 2012-08-28 23:01 Yogurt Shen 阅读(146) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2260 挺水的。。。 #include<stdio.h>#define MAXN 102int n,a[MAXN][MAXN],row[MAXN],col[MAXN];int main(void){ int i,j,k,cc,cr; while(scanf("%d",&n)&&n) { for(i=0;... 阅读全文
posted @ 2012-08-28 22:52 Yogurt Shen 阅读(174) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1555 我再也不想写if-else了。。。。。 #include<stdio.h>int main(void){ int i,low,high,flag,num[9]; while(scanf("%d%d%d%d%d%d%d%d%d",&num[8],&num[7],&num[6],&num[5],&num[4],&num... 阅读全文
posted @ 2012-08-28 22:50 Yogurt Shen 阅读(268) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1504 水题不解释。 #include<stdio.h>int reverse(int n){ int j=0; while(n>0) { j=j*10+n%10; n/=10; } return j;}int main(void){ int n,i,a,b,sum; ... 阅读全文
posted @ 2012-08-28 22:42 Yogurt Shen 阅读(136) 评论(0) 推荐(0) 编辑