- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 poj2892——Tunnel Warfare
<br />...(poj可过,hdu过不去,郁闷!)<br />#include<iostream>#include<cstdio>#include<cstring>using namespace std;#define maxn 50005int ans,n,m;int stack[maxn],top;class tree{public: int l,r,lx,rx;};tree st[maxn*4];void build(int index,int
2011-02-27 16:19:00 438
原创 zoj3327——Friend Number
<br />题意&思路 参见http://apps.hi.baidu.com/share/detail/16155270<br />数学题!在比赛中做出的非牛即牛啊!!!<br />#include<iostream>#include<cstring>using namespace std;char num[1005];char tt[1005];int net[5],kk[1005],len;void ok(int end){ int i,j,k; for(i=0;i
2011-02-24 19:03:00 645
原创 hdu1358——Period
<br />题意:类似周期<br />思路:利用kmp中的next[]直接解决。<br />#include<iostream>#include<cstdio>#include<cstring>using namespace std;char s[1000002];int next[1000002];int n;void getnext(char s[],int next[],int len){ next[0]=-1; int j=-1; for(int i=1;
2011-02-21 23:25:00 470
原创 poj1151——Atlantis
<br />题意:求轮廓面积。<br />思路:离散化+线段树。和求周长一样的思路。<br />#include<cstdio>#include<iostream>#include<string>#include<algorithm>using namespace std;#define maxn 120int n,cnt;double INDEX[maxn*3];//存yclass line{public: double st,ed; double x;
2011-02-21 22:13:00 662
原创 poj2318——TOYS
<br />题意:求图中各个区域中有多少个玩具。<br />思路:外积+二分<br />ps:这小家伙确实淘气 只知当时头挺晕的...撑着将此题过了。休息<br />#include<iostream>#include<cstring>#include<cstdio>using namespace std;class T{public: int x1,x2;};T toy[5005];int g[5005];int y1,y2,n,m,x,y,t;int
2011-02-20 22:40:00 322
原创 zoj3326——An Awful Problem
<br />题意:计算给定时间内满足其月份为质数,日期为质数的天数。<br />思路:分多种情况。<br />#include<iostream>using namespace std;int sy,sm,sd,ey,em,ed;const int leapyear =53;const int year=52;int leapm[13]={0,0,10,11,0,11,0,11,0,0,0,10,0};int m[13]={0,0,9,11,0,11,0,11,0,0,0,10,0}
2011-02-20 15:26:00 885
原创 poj2049——Finding Nemo
题意:迷宫问题注意:1,见图方式,需要两二维数组来分别记录横、竖边的信息。2,需优先队列跳过自己添加的边。3,将格子问题转化为点问题。#include#includeusing namespace std;class wall{public: int x,y,d,l;};class doo{public: int x,y,d;};wall wa;doo door;int m,n,xmax,ymax;double nx,ny;#define ma
2011-02-20 01:15:00 559
原创 hdu2203——亲和串
题意:判断s1是否是s2的亲和串。思路:将s1接在s1后面,然后作kmp判断。#includeusing namespace std ;char s1[100002*2],s2[100003];int next[100002*2];void getnext(char s[],int next[]){ next[0]=-1; int j=-1; int len1=strlen(s); for(int i=1;i-1&&s[j+1]!=s[i]) j=next[j];
2011-02-19 20:17:00 585
原创 poj1308——Is It A Tree?
<br />并查集的简单应用。<br />注意:1、空树也是树;2、记得判断是否成了森林。<br />#include<iostream>#include<cstdio>using namespace std;int sta[1000],flag,pa[1000];int find(int a){ int x=a; while(x!=pa[x]) x=pa[x]; return x;}void unio(int a,int b){ pa[b]=a;}
2011-02-18 15:26:00 525
原创 poj3125——Printer Queue
<br />题意:优先级模拟<br />思路:循环队列处理。<br />#include<iostream>using namespace std;class queue{public: int a; bool pos; queue() { pos=false; }};void solve(){ int n,pt,i,max; cin>>n>>pt; queue q[150]; q[pt].pos =true; for(i=0;i<n
2011-02-18 14:04:00 612
原创 poj2106——Boolean Expressions
<br />题意:求表达式运算<br />思路:同数字表达式运算一样,先转后缀,再求值。<br />注意点:1,'('在进栈时,优先级最高,出栈时相反;<br /> 2,对于'!',单目表达式的计算,在转后缀的时候,需将数值进栈,再将其压入后缀表达式中;<br />#include<cstdio>#include<cstring>#include<iostream>using namespace std;const int len =120; char infi
2011-02-16 20:27:00 973
创建学生信息管理系统
2010-12-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人