上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 71 下一页
摘要: http://poj.org/problem?id=3414六种情况 搜一下View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 struct node 6 { 7 int ca,cb; 8 int flag,num; 9 int op,ob; 10 }q[1000000]; 11 int a,b,c,vis[110][110],num[100000],g; 12 void put(int x,int y) 13 ... 阅读全文
posted @ 2013-01-26 08:25 _雨 阅读(170) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3083纠结了好久 被它的转向搞晕 了WA两次 加一else AC。。设置四个方向 初始化方向自己算出来 初始化在数组中 dfs+bfs左 就是当前方向向左 左走不动就逆时针走下一个方向 依次类推 右同样的方式View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 char s[50][50],so[2]; 6 int pr[7],dis[4][2]={-1,0,0,-1, 阅读全文
posted @ 2013-01-24 00:50 _雨 阅读(187) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1442题意很难懂 题挺巧妙的 建立两个优先队列 一个从小到大 另一个从大到小 随时更新两队中的值 使其为1~i 和i+1~mView Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<queue> 5 using namespace std; 6 int num[30010],op[30010]; 7 int main() 8 { 9 int n,m,i,j,k,g;10 while(cin 阅读全文
posted @ 2013-01-23 15:16 _雨 阅读(153) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2442题解http://www.cnblogs.com/372465774y/archive/2012/07/09/2583866.html本来写的二维数组 ,直接対一维排序 不知道为嘛一直WA 只好该为一维的 就AC了View Code 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int num1[2005],num2[2005]; 8 bool cmp(int a,int b) 9 {10 return a>t... 阅读全文
posted @ 2013-01-23 10:07 _雨 阅读(198) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2002刚开始hash的两点 TLE了 又改为一点 已知对角两点 求令两点View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 #define MOD 977777 6 int head[1000010],v[1000010],next[1000010],num[1000010][2],t,f[1010][1010]; 7 struct node 8 { 9 int x, 阅读全文
posted @ 2013-01-22 20:45 _雨 阅读(159) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1840枚举 xi不等0.View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 #define MOD 97777 6 #define size 1000010 7 int t,head[size],next[size],v[size],num[size][2]; 8 void init() 9 {10 t =0 ;11 memset(head,-1,sizeof(hea 阅读全文
posted @ 2013-01-22 17:10 _雨 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3274网上题解数组sum[i][j]表示从第1到第i头cow属性j的出现次数。所以题目要求等价为:求满足sum[i][0]-sum[j][0]=sum[i][1]-sum[j][1]=.....=sum[i][k-1]-sum[j][k-1] (j<i)中最大的i-j将上式变换可得到sum[i][1]-sum[i][0] = sum[j][1]-sum[j][0]sum[i][2]-sum[i][0] = sum[j][2]-sum[j][0]......sum[i][k-1]-sum[i][0] = sum[j][k-1]-sum[ 阅读全文
posted @ 2013-01-22 14:07 _雨 阅读(220) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 int board[110][110]; 6 int di,dj,xi,xj,n,m,num,dis[4][2] = {0,1,0,-1,1,0,-1,0}; 7 void dfs(int v,int x,int y) 8 { 9 int i,tx,ty,flag = 0;10 if(v>10)11 return ;12 for(i = 0 ; i < 4 阅读全文
posted @ 2013-01-21 17:27 _雨 阅读(143) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3087一道模拟题折腾了好久View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<map> 6 using namespace std; 7 map<string,int>ff; 8 int main() 9 {10 int i,j,k,n;11 char s1[110],s2[110],s[300],ss[300];1 阅读全文
posted @ 2013-01-20 15:47 _雨 阅读(127) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2418 trie树,有非空格、字母的字符View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<stdlib.h> 5 #include<algorithm> 6 using namespace std; 7 typedef struct node 8 { 9 int num;10 struct node *next[130];11 node()12 {13 memset(n 阅读全文
posted @ 2013-01-20 15:45 _雨 阅读(177) 评论(0) 推荐(0) 编辑
上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 71 下一页