自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 资源 (1)
  • 收藏
  • 关注

转载 hdu1180——诡异的楼梯

愤啊。。。居然不过,火了。。。等哪天我乐意了,再自己A贴上复制代码:#include #include using namespace std; int dir[4][2]={0,1,1,0,0,-1,-1,0}; int m,n,ai,bi,ci,di; char map[21][21]; int visited[21][21]; struct node { int x,y; int time; };

2010-10-31 21:50:00 548

原创 poj3468——A Simple Problem with Integers

<br />线段树之整段更新操作<br />思路:为提高效率,每次有insert操作的时候,如果刚好一个区间的数都需加ad,那么,将此区间的st[i].ad赋为ad。查找过程,如果经过此区间的话,那么,需做ans+=st[i].ad*(r-l+1),此处的r,l是指要查的那个区间!<br />#include<stdio.h> #include<string.h> #define max 100005 struct node { int l,r; __int64 add,sum; }st[

2010-10-28 15:12:00 405

原创 poj2777——Count Color

搞得好囧,像自己A,结果还是盗版货,而且郁闷了好久才见ac的,擦擦。。。ps:本来也想这么做的:每次染色的时候,并不更新到子节点,而是把信息上次的和目前的信息综合之后,再判断是否向下更新的,结果,采用基本做法,TLE到死........#include #include #define max 100005 struct node { int l,r; int color; }st[max*4]; bool co[35]; int L,T,O,ans; void create(int

2010-10-27 22:17:00 495

原创 poj1177——Picture

线段树+离散化+扫描:离散化的概念可以参考99年国家集训队陈宏的论文。重点理解两个公式:[1]   ans+=st[1].segnum *2*(yline[i+1].x-yline[i].x);                           [2]   ans+=abs(st[1].sum-lsum);首先,读入数据,存入yline[]数组中,并将y坐标存入INDEX[]数组中,其中,yline[]的结构应该为:struct line { int st,ed;//记录竖段的上下坐标 int

2010-10-26 13:30:00 951

原创 hdu1166——敌兵布阵

线段树的基本操作!线段树关键在于结束条件的判断,即跨区查找的时候,注意点!#include #include #define max 50005 struct node { int lt,rt; int num; }tree[max*4]; int n; char a[]="Add",s[]="Sub",q[]="Query",e[]="End"; void create(int lt,int rt,int index) { tree[index].lt =l

2010-10-22 16:04:00 550

原创 zjgsu1229——校外的树

#include #include #define max 10005 struct node { int lt,rt; bool t; }tree[max*4]; int sum,l,m; void create(int lt,int rt,int index) { tree[index].lt =lt; tree[index].rt =rt; tree[index].t =true; if(lt==rt) return; int mid=(lt+rt)>

2010-10-21 21:58:00 555

原创 poj2135——Farm Tour

刚开始,以为是最小环,结果想了一下午没真相~ 看了讨论,才知道是最小费用最大流!不过,这道题的构图也是一个难点啊!//以后,最大值的设定要注意 //head[]相当于链表头,pre[]存的也是边 //当然,这道题还有异或的巧妙运用 #include #include #define M 40020 #define N 10020 #define INF 0x3f3f3f3f struct node { int u,v,f,c; int next; }edg[M]; int h

2010-10-18 09:29:00 525

原创 poj1321——棋盘问题

深搜问题,需剪枝!思路:      从g[0][0]开始,统计出包含g[0][0]在内的所有情况,然后,接下来,统计包含g[0][1]但不包含g[0][0]的情况,再统计g[0][2]且排除了g[0][0],g[0][1]的点......以此类推!#include #include char g[10][10]; bool pp[10][10],tempx[10],tempy[10]; int n,k,totalx,totaly,num,sum; void dfs(int flag) { i

2010-10-16 14:16:00 443

原创 poj1088——滑雪

<br />真是高兴呀!!!DFS+DP,一点没搜报告。在脑海中想了N多天,终于在今天给A了!<br />后来想想,其实,DFS最重要的是结束条件的判断!<br /> <br />#include<stdio.h> #include<string.h> int map[102][102],pp[102][102]; bool g[102][102]; int dir[][2]={{-1,0},{1,0},{0,-1},{0,1}}; int n,m; int dfs(int x,int y)

2010-10-15 15:22:00 500

原创 poj3481——Double Queue

map应用!map网上详细讲解地址:http://www.kuqin.com/cpluspluslib/20071231/3265.htmlhttp://mxdxm.javaeye.com/blog/518571http://weihuachao1984.blog.163.com/blog/static/328712862008102411386264/#pragma warning (disable:4786) #include #include #include using namespace

2010-10-14 17:14:00 573

原创 zjgsuoj1161——软件工程

这次热身赛唯一有点高兴的是,这题刷屏了!#include #include int queue[100006]; struct node { int time; bool tt; int num[12]; int k; }pp[10005]; int n,m,p; void st() { int front=0,temp,rear=0,r=0,i,k; rear++; queue[rear]=m; r+=pp[m

2010-10-12 17:50:00 533

原创 poj1298——史上最难的问题

<br />纯净水<br />#include<stdio.h> #include<string.h> char ch[30]="VWXYZABCDEFGHIJKLMNOPQRSTU"; char a[30],mi[210]; char en[20]="ENDOFINPUT"; int main() { while(scanf("%s",&a)!=EOF) { if(strcmp(a,en)==0) break; getchar(); gets(mi); /

2010-10-11 13:18:00 1395

原创 hdu2674——N!Again

<br />擦,这水题,其实是纸老虎!<br />因为大于2009(其实287就可以了)的N,其N!一定等于0!<br />让我想了一个多小时呀!<br />#include<stdio.h> int n; int main() { int i,flag; while(scanf("%d",&n)!=EOF) { flag=1; if(n==0) flag=1; else if

2010-10-11 00:07:00 661

原创 待解决

poj:http://poj.org/problem?id=1012:http://poj.org/problem?id=1088

2010-10-10 14:36:00 2719

原创 poj1002——487-3279

#include #include #include char ch[100]; int n; struct node { bool used; char num[20]; int t; }ph[100005]; void tan(int t) { int i,l=strlen(ch),j=0; for(i=0;i

2010-10-10 11:44:00 323

原创 poj2503——Babelfish

hash的运用,关键在于hash函数的构造!此题的hash函数构造很是经典!(我也不甚理解^>^)PS:链表还有待加强!#include #include #include #include using namespace std; typedef struct node { char a[3][15]; struct node *next; }hash; hash *head[100005]; char s1[15],s2[15],w[30],dic[15],am[15]="..

2010-10-08 16:02:00 496

原创 链表的各项操作——涉及指针

<br />#include<stdio.h> #include<stdlib.h> #include<malloc.h> struct st { int num; struct st * next; }; struct st * create(); struct st * insert(struct st * head); struct st * zeng(struct st * head); struct st * shan(struct st * head); struc

2010-10-07 17:42:00 461

创建学生信息管理系统

创建一个存储和显示学生信息的单文档应用程序。 功能如下:在编辑框中输入学生信息,单击“输入”按钮时,程序检测编号与以后学生信息是否重复,如果重复则跳出消息框提示“学号重复,请修改学生学号”,如果编号和姓名栏中是空的,系统提示“学生信息不全,请补全信息”,如果无上述情况,系统自动把输入内容存储到文档类中的一个学生信息类对象的数组中; 主菜单“编辑”中包含了“清空”子菜单,单击该子菜单或者点击工具栏上的红色“C”按钮时,删除所有学生的信息,并且清空界面上的“编号”和“姓名”编辑栏。

2010-12-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除