C语言
文章平均质量分 78
牧野之歌
这个作者很懒,什么都没留下…
展开
-
杭电1178--Heritage from father
Problem DescriptionFamous Harry Potter,who seemd to be anormal and poor boy,is actually a wizard.Everything changed when hehad his birthday of ten years old.A huge man called 'Hagrid' foundHarry a原创 2014-06-07 17:44:20 · 399 阅读 · 0 评论 -
poj1730--Perfect Pth Powers
DescriptionPth Powers" TITLE="poj1730--Perfect Pth Powers" />We say that x is a perfectsquare if, for some integer b, x = b2. Similarly, x is aperfect cube if, for some integer b, x = b3. Moregen原创 2014-06-07 17:44:16 · 312 阅读 · 0 评论 -
HDU 1174 爆头
原文地址:1174 爆头">HDU 1174 爆头作者:swjgold爆头 Problem Descriptiongameboy是一个CS高手,他最喜欢的就是扮演警察,手持M4爆土匪的头。也许这里有人没玩过CS,有必要介绍一下“爆头”这个术语:所谓爆头,就是子弹直接命中对方的头部,以秒杀敌人。现在用一个三维的直角坐标系来描述游戏中的三维空间(水平面为xoy平面,z轴正方向是上方)。假转载 2014-06-07 17:44:12 · 362 阅读 · 0 评论 -
杭电2066--一个人的旅行(最短路径…
ProblemDescription虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女……眼看寒假就快到了,这么一大段时原创 2014-06-07 17:43:59 · 507 阅读 · 0 评论 -
杭电1176--免费馅饼
Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个原创 2014-06-07 17:43:57 · 483 阅读 · 0 评论 -
杭电2680--Choose the best route…
Problem DescriptionOne day , Kiki wants to visit one of her friends. As she isliable to carsickness , she wants to arrive at her friend’s home assoon as possible . Now give you a map of the city’s原创 2014-06-07 17:43:55 · 364 阅读 · 0 评论 -
杭电2544--最短路(最短路径)(1->1…
ProblemDescription在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N输入保证至少存在1条商店到赛场的路线。Output对于每组输入,输出一行原创 2014-06-07 17:43:50 · 326 阅读 · 0 评论 -
杭电1301--Jungle Roads(最小生成…
Problem DescriptionRoads(最小生成树)" TITLE="杭电1301--Jungle Roads(最小生成树)" />The Head Elder of the tropical island of Lagrishan has a problem. Aburst of foreign aid money was spent on extra roads betw原创 2014-06-07 17:43:48 · 350 阅读 · 0 评论 -
杭电1171--Big Event in HDU(多重…
ProblemDescriptionNowadays, we all know that ComputerCollege is the biggest department in HDU. But, maybe you don't knowthat Computer College had ever been split into Computer College andSoftware原创 2014-06-07 17:43:24 · 268 阅读 · 0 评论 -
杭电1242--Rescue(BFS+优先队列)
Problem DescriptionAngel was caught by the MOLIGPY! He was put in prison byMoligpy. The prison is described as a N * M (N, M <=200) matrix. There are WALLs, ROADs, and GUARDs in theprison.Angel'原创 2014-06-07 17:43:14 · 406 阅读 · 0 评论 -
poj1226--Substrings
DescriptionYou are given a number ofcase-sensitive strings of alphabetic characters, find the largeststring X, such that either X, or its inverse can be found as asubstring of any of the given str原创 2014-06-07 17:43:01 · 336 阅读 · 0 评论 -
ZZULI 1209二叉树(二)
二叉树(2)Time Limit:1000MS MemoryLimit:65536KTotal Submit:82 Accepted:37Description1、按扩展的先序序列(即包括空结点,1表示空结点)输入二叉树的各结点,建立二叉树,1209二叉树(二)" TITLE="ZZULI 1209二叉树(二)" />输出包括两行,第一行为该二叉树的高度,第二行按自左至右的顺序原创 2014-06-07 17:42:44 · 309 阅读 · 0 评论 -
杭电1232——畅通工程(并查集的入门…
***升级预告:今年暑假HDOJ将再增加2个模块,敬请期待~杭电2010和2011级同学如何申请加入HDU-ACM集训队?畅通工程TimeLimit: 4000/2000 MS(Java/Others) MemoryLimit: 65536/32768 K (Java/Others)Total Submission(s):10996 AcceptedSubm原创 2014-06-07 17:42:37 · 363 阅读 · 0 评论 -
杭电1022(栈的入门)(二)
Train Problem ITimeLimit: 2000/1000 MS(Java/Others) MemoryLimit: 65536/32768 K (Java/Others)Total Submission(s):6393 AcceptedSubmission(s): 2337Problem DescriptionAs the new term comes原创 2014-06-07 17:42:31 · 317 阅读 · 0 评论 -
杭电 一只小蜜蜂……2044
大菲波数1,1,2,3,5,8,13,21……f[i]=f[i-1]+f[i-2]: # includeint main(){ int i,a,b,n,ncase; __int64 f[51]; f[1]=1;f[2]=2; for(i=3;i f[i]=f[i-1]+f[i-2]; scanf("%d",&ncase); for(i=1;i { scan原创 2014-06-07 17:42:22 · 368 阅读 · 0 评论 -
杭电 human number1058
如果N为humble number,则必满足N=pow(2,i)*pow(3,j)*pow(5,k)*pow(7,l);i,j,k,l逐渐递增,依次枚举出! #includeint main(){ int m,n,i,j,k,l,min,x1,x2,x3,x4,a[5843]; i=j=k=l=1; a[0]=1; for(m=1;m { x1=a[i-1]*2;原创 2014-06-07 17:42:20 · 369 阅读 · 0 评论 -
zoj2016--Play on Words
DescriptionSome of the secret doors contain a veryinteresting word puzzle. The team of archaeologists has to solve itto open that doors. Because there is no other way to open thedoors, the puzzle原创 2014-06-07 17:44:18 · 411 阅读 · 0 评论 -
杭电1715--大菲波数(大整数加法)
Problem DescriptionFibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3。计算第n项Fibonacci数值。Input输入第一行为一个整数N,接下来N行为整数Pi(1Output输出为N行,每行为对应的f(Pi)。Sample Input512345Sample Output11235原创 2014-06-07 17:44:31 · 467 阅读 · 0 评论 -
poj1315--Don't Get Rooked(DPS)
DescriptionIn chess, the rookis a piece that can move any number of squares vertically orhorizontally. In this problem we will consider small chess boards(at most 4x4) that can also contain walls原创 2014-06-07 17:43:26 · 492 阅读 · 0 评论 -
杭电1198--Farm Irrigation(BFS外…
Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is arectangle, and is divided into a lot of samll squares. Water pipesare placed in these squares. Different square has原创 2014-06-07 17:43:07 · 359 阅读 · 0 评论 -
poj1028(栈的运用)(三)
Web NavigationTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 20305Accepted: 8943DescriptionStandard web browsers containfeatures to move backward and forward among the pag原创 2014-06-07 17:42:35 · 400 阅读 · 0 评论 -
poj1363(栈的入门)(一)
RailsInputThe input consists of blocks oflines. Each block except the last describes one train and possiblymore requirements for its reorganization. In the first line of theblock there is the int原创 2014-06-07 17:42:33 · 742 阅读 · 0 评论 -
杭电 2084
# includeint Qmax(int a,int b){ if(a return b; return a;}int main(){ int ncase,floor,a[101][101],i,j,k; scanf("%d",&ncase); for(k=1;k { int max=0; scanf("%d",&floor); for(i=1;i原创 2014-06-07 17:42:18 · 484 阅读 · 0 评论 -
杭电 ACM 1014
不学好英文还真不行啊!!…… ProblemDescriptionComputer simulations often requirerandom numbers. One way to generate pseudo-random numbers is via afunction of the formseed(x+1) = [seed(x) + STEP] % MODwhere原创 2014-06-07 17:42:12 · 439 阅读 · 0 评论 -
杭电1716--排列2(DFS)
Problem DescriptionRay又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。Input每组数据占一行,代表四张卡片上的数字(0Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成的4位数,千位数字相同的在同一行,同一行中每个四位数间用空格分隔。每组输出数据间空一行,最后一组数据后面没有空原创 2014-06-07 17:44:33 · 414 阅读 · 0 评论 -
poj2395--Out of Hay(最小生成树)
DescriptionThe cows have runout of hay, a horrible event that must be remedied immediately.Bessie intends to visit the other farms to survey their haysituation. There are N (2 <= N <=2,000) farms原创 2014-06-07 17:44:07 · 323 阅读 · 0 评论 -
链表的相关操作
# include# includetypedef struct Plnode{ int data; struct Plnode *next;}Lnode,*linklist;int m=sizeof(Lnode); //创建链表linklist Creat(linklist head,int n){ int i;原创 2014-06-07 17:43:37 · 363 阅读 · 0 评论 -
杭电1372--Knight Moves(BFS)
Problem DescriptionA friend of you is doing research on the Traveling KnightProblem (TKP) where you are to find the shortest closed tour ofknight moves that visits each square of a given set of n s原创 2014-06-07 17:43:10 · 341 阅读 · 0 评论 -
poj3984--迷宫问题(输出最短路径BF…
Description定义一个二维数组:int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左原创 2014-06-07 17:42:59 · 762 阅读 · 0 评论 -
zzuli 1208二叉树(一)
二叉树(1)Time Limit:1000MS MemoryLimit:65536KTotal Submit:193 Accepted:80Description1、按扩展的先序序列(即包括空结点)输入二叉树的各结点,建立二叉树,并输出其先序、中序和后序遍历序列。1208二叉树(一)" TITLE="zzuli 1208二叉树(一)" />如图所示的二叉树的扩展的先序序列为:A原创 2014-06-07 17:42:42 · 323 阅读 · 0 评论 -
杭电1426--Sudoku Killer(深搜)
Problem Description自从2006年3月10日至11日的首届数独世界锦标赛以后,数独这项游戏越来越受到人们的喜爱和重视。据说,在2008北京奥运会上,会将数独列为一个单独的项目进行比赛,冠军将有可能获得的一份巨大的奖品———HDU免费七日游外加lcy亲笔签名以及同hduacm team合影留念的机会。所以全球人民前仆后继,为了奖品日夜训练茶饭不思。当然也包括初学者linl原创 2014-06-07 17:44:44 · 342 阅读 · 0 评论 -
杭电 1671——Phone List
ProblemDescriptionGiven a list of phone numbers, determineif it is consistent in the sense that no number is the prefix ofanother. Let’s say the phone catalogue listed these numbers:1. Emergency原创 2014-06-07 17:44:41 · 374 阅读 · 0 评论 -
杭电1251--统计难题
ProblemDescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行原创 2014-06-07 17:44:37 · 352 阅读 · 0 评论 -
杭电 1003--Max Sum(初级DP)
ProblemDescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is tocalculate the max sum of a sub-sequence. For example, given(6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 +原创 2014-06-07 17:42:16 · 424 阅读 · 0 评论 -
c语言排序
105 2 7 4 3 1 6 9 8 0冒泡排序# includeint main(){ int n,i,j,a[1000],temp,flag=1; scanf("%d",&n); for(i=0;i scanf("%d",&a[i]); for(i=1;i { for(j=0;j if(a[j+1] { temp=a[j+1];原创 2014-06-07 17:42:14 · 361 阅读 · 0 评论 -
hdu 2544 最短路 floyd或spf…
原文地址:2544 最短路 floyd或spfa或Dijkstra或bellman_ford">hdu 2544 最短路 floyd或spfa或Dijkstra或bellman_ford作者:星梦随缘四种最短方法同时实现本题目:code:#include#define M 110struct node{ intu,v,w;}edge[M*M];int m,n,a[M][M]转载 2014-06-07 17:43:52 · 324 阅读 · 0 评论 -
杭电1233--还是畅通工程(最小生成…
ProblemDescription某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N (< 100);随后的N(N-1)/2原创 2014-06-07 17:43:42 · 341 阅读 · 0 评论 -
1, 10, 100, 1000...
原文地址:10, 100, 1000...">1, 10, 100, 1000...作者:凌晨一度DescriptionLet's consider an infinite sequenceof digits constructed of ascending powers of 10 written one afteranother. Here is the beginning of转载 2014-06-07 17:43:31 · 418 阅读 · 0 评论 -
杭电1087--Super Jumping! Jumping…
Nowadays, a kind of chess game called “Super Jumping! Jumping!Jumping!” is very popular in HDU. Maybe you are a good boy, andknow little about this game, so I introduce it to you now.Jumping! Jump原创 2014-06-07 17:43:18 · 330 阅读 · 0 评论 -
杭电1753--大明A+B
Problem Description话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法。现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。 Input本题目包含多组测试数据,请处理到文件结束。每一组测试数据在一行里面包含两个长度不大于400的正小原创 2014-06-07 17:43:03 · 361 阅读 · 0 评论