2012年4月9日

poj 2996 模拟

摘要: 参考http://blog.csdn.net/jun_sky/article/details/7008625 1 #include <iostream> 2 #include <stdio.h> 3 #include <algorithm> 4 using namespace std; 5 struct node 6 { 7 int x,y,p; 8 char c; 9 }b[70],w[70];10 int in(char c)11 {12 switch(c)13 {14 case 'K':case 'k':return 1 阅读全文

posted @ 2012-04-09 10:17 Inpeace7 阅读(234) 评论(0) 推荐(0) 编辑

2012年4月6日

poj 1573 模拟

摘要: 水题 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 6 int n,m; 7 8 bool out(int x,int y){if((x>=0 && x<n)&&(y>=0 && y<m))return 0;return 1;} 9 10 int main()11 {12 int start;13 bool visit[12][12];14 char c[ 阅读全文

posted @ 2012-04-06 17:02 Inpeace7 阅读(140) 评论(0) 推荐(0) 编辑

poj 2632 模拟

摘要: 模拟题,注意两点1.坐标2.L,R后边的数字是向左或向右转几次 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 const int maxx=102; 6 int loc[maxx][maxx],a,b; //loc 地图第ij个位置是第几个机器人 7 char dir[maxx][maxx]; 8 struct OPE //操作 9 { 10 int ind; 11 char op; 12 ... 阅读全文

posted @ 2012-04-06 15:18 Inpeace7 阅读(194) 评论(0) 推荐(0) 编辑

poj 1068 模拟

摘要: 模拟能力太水,做了挺长时间还原括号数组,令r=1,num=0,从“(”向前扫,遇到“(”,r--,num++;遇到“)”r++,r为0是num即为解 1 #include <stdio.h> 2 #include <string.h> 3 int main() 4 { 5 int n,t,r,num,i,j,b[25]; 6 bool c[100]; 7 scanf("%d",&t); 8 for(int tt=1;tt<=t;tt++) 9 {10 memset(c,0,sizeof(c));11 scanf("%d&quo 阅读全文

posted @ 2012-04-06 09:36 Inpeace7 阅读(142) 评论(0) 推荐(0) 编辑

2012年4月5日

poj 3295 前缀表达式求值

摘要: 前缀表达式求值,和后缀一样,只不过是从后往前读 1 #include <iostream> 2 #include <string.h> 3 #include <stdio.h> 4 #include <stack> 5 #include <algorithm> 6 using namespace std; 7 8 bool change(char s[],bool val[]) 9 {10 stack <bool> nd;11 bool a,b;12 int len=strlen(s),i,j;13 for(i=0;i&l 阅读全文

posted @ 2012-04-05 16:35 Inpeace7 阅读(246) 评论(0) 推荐(0) 编辑

2012年4月3日

csu 1183 表达式求值

摘要: 表达式求值,注意:输入可能有\t!!!!没有考虑到,re到死代码: 1 #include <iostream> 2 #include <stack> 3 #include <string.h> 4 #include <cstdio> 5 using namespace std; 6 const int maxx=1000; 7 int precede(char c) 8 { 9 switch(c) 10 { 11 case '+': 12 case '-':return 1; 13 case '*' 阅读全文

posted @ 2012-04-03 21:01 Inpeace7 阅读(196) 评论(0) 推荐(0) 编辑

2012年4月2日

hdu 3596 表达式求值

摘要: 1 #include <iostream> 2 #include <stack> 3 #include <string.h> 4 #include <stdio.h> 5 #include <cmath> 6 using namespace std; 7 8 const int maxx=10000; 9 const int inf=0x7fffffff; 10 11 int precede(char c) 12 { 13 switch(c) 14 { 15 case '+': 16 case '-': 阅读全文

posted @ 2012-04-02 22:04 Inpeace7 阅读(563) 评论(0) 推荐(0) 编辑

2012年4月1日

poj 2586 贪心

摘要: 题意:每个月会给出一个财务报告:赢利或者亏空 如果赢利则赢利s,如果亏空则亏空d(12个月都一样,只有赢利s或者亏空d两种情况)每五个月也会给出一个报告(1~5 ,2~6 。。。)一年一共有8次这样的报告,已知这8次都报告亏空问整年情况:如果亏空则输出Deficit,如果赢利,输出整年可能赢利的最大值可能情况(1)ssssd ssssd ss d>4s ===>d>4s 盈利:10s-2d (2)sssdd sssdd ss 2d>3s ===>d>3/2s 盈利:8s-4d (3)ssddd ssddd ss 3d>2s ==... 阅读全文

posted @ 2012-04-01 11:44 Inpeace7 阅读(188) 评论(0) 推荐(0) 编辑

poj 1328 贪心

摘要: 贪心。以每个岛屿为圆心,在x轴上求出雷达可能出现的区间,重叠的区间只用一个雷达 1 #include <iostream> 2 #include <algorithm> 3 #include <cmath> 4 #include <stdio.h> 5 using namespace std; 6 typedef double ll; 7 const int maxx=1000; 8 struct PO 9 {10 ll l,r;11 };12 PO point[maxx+5];13 14 bool cmp(PO a,PO b)15 {16 if 阅读全文

posted @ 2012-04-01 10:21 Inpeace7 阅读(157) 评论(0) 推荐(0) 编辑

2012年3月30日

poj 2965 BFS

摘要: 状态压缩,记录路径 1 #include <iostream> 2 #include <string.h> 3 #include <stdio.h> 4 using namespace std; 5 const int maxx=100000; 6 char c[4][4]; 7 int que[maxx],cnt,step[maxx],n; 8 struct FF 9 { 10 int fa; 11 int path; 12 }; 13 FF father[maxx]; 14 int t[16]={63624,62532,61986,61713,36744 阅读全文

posted @ 2012-03-30 15:37 Inpeace7 阅读(149) 评论(0) 推荐(0) 编辑

导航