上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
摘要: Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输 入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店 所在地,标号为N的路口是赛场所在地,M则表示在成都有几条路。N=M=0表示输入结束。接下来M行,每行包括3个整数A,B,C(1<=A,B& lt;=N,1<=C<=1000),表示在路 阅读全文
posted @ 2012-03-18 19:54 狸の舞 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对正整数,分别是该条道路直接连通的两个城镇的编号。为简单起见,城镇从1到N编号。 注意:两个城市之间可以有多条道路相通,也就是说 3 3 1 2 1 2 2 1 这种输入也是合法的 当N 阅读全文
posted @ 2012-03-10 16:11 狸の舞 阅读(114) 评论(0) 推荐(0) 编辑
摘要: DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, and all the friends do not want to stay with strangers.One important rule for this 阅读全文
posted @ 2012-03-10 16:10 狸の舞 阅读(141) 评论(0) 推荐(0) 编辑
摘要: DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements.Mr Wang selected a room big enough to hold the boys. The boy who are not been chosen has to leave the room immedia 阅读全文
posted @ 2012-03-10 16:09 狸の舞 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Description一个初始化为空的队列,共有三种操作,pop,push,queryInputpop操作, 输入pop, 输出并且删除队首的元素,如果没有则输出 empty!;push操作,输入push d(d为一个整数);query操作,输入query k(k为一个整数),输出队列中第k个元素,如果没有则输出 empty!.Output按要求输出Sample Inputpop push 1 pop push 10 query 1 Sample Outputempty! 1 10 #include<stdio.h>#include<string.h>int queue 阅读全文
posted @ 2012-03-06 21:13 狸の舞 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Description一天粒粒想到我们实验室玩个小游戏!n个人围成一圈!一起报数!报到第m的时候!那个报m的退出!又从1开始报!依次类推!只到剩下一个人为止!ACMer丹丹想知道那些位置的人依次退出!ACMer抛抛想知道最后是一个人是那个位置!做为聪明的ACMer请设计一个程序告诉她们吧!(位置编号从1开始顺时针到n)用循环链表写Input输入二个数 n 和 m。Output输出依次退出的位置编号!每个一行!以及最后一个留下的人的位置编号!Sample Input1 2 5 3Sample Output1 3 1 5 2 4View Code 1 #include <stdio.h> 阅读全文
posted @ 2012-03-06 21:12 狸の舞 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Description实验室有犬初长成,名曰dogdog,静若处子,动若脱兔,回眸一笑百媚生,工大粉黛无颜色。日前,沉溺于LinkList,无法自拔。 某日,某丹发现某狗在写链表的非降序合并...所以来和狗狗比赛下谁的链表更厉害吧!~ Just ac it!Input输入一个数字n,接下来是n组数据,对于每组数据输入一个a、一个b,然后是2条非降序链表。(a表示第一条链表的长度,b表示第二条链表的长度...)Output这两条链表合并后的一条非降序链表,并在每组数据之间有行空行。Sample Input2 5 4 1 2 3 4 5 6 7 8 9 5 5 1 3 5 7 9 2 4 6 8 阅读全文
posted @ 2012-03-06 21:10 狸の舞 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Description这个链表共有五种操作Inputloc 为正数,x为一整型数,"insert loc x"表示将整数x插入链表作为链表第loc个数据"erase loc"表示删除链表的第loc个数据(测试数据保证loc小于链表的结点总数)"output"表示输出链表所有的数据,数据间用空格隔开"find x"表示在链表中查找值为x的数据,若查找到则输出"hava found",没找到输出"not found""end"表示程序结束Output按要求输出 阅读全文
posted @ 2012-03-06 20:30 狸の舞 阅读(222) 评论(0) 推荐(0) 编辑
摘要: Description今天抛抛和狗神一块去买黑板,碰到了pis大神。pis请他们吃包子,自然他们就开始不客气的吃起来。他们吃的数量可以用一个一元多项式来表示,要注意的是:他们所吃的数量,有着相同的指数,这个你懂的。(如dogdog eat 3x^2+2x and paopao eat 5x^2+x,then they eat 8x^2+3x) 用链表写Input第一行,输入多项式的每一项的系数与指数并以0 0为结束标志。接下来输入多项式的每一项的系数与指数并以0 0为结束标志。Output进行相加后的各项系数和指数.Sample Input4 2 1 1 0 0 7 2 1 1 0 0 Sam 阅读全文
posted @ 2012-03-06 12:54 狸の舞 阅读(173) 评论(0) 推荐(0) 编辑
摘要: DescriptionA robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page)S south (down the page)E east (to the right on the page)W west (to the left on the page) 阅读全文
posted @ 2012-03-04 18:40 狸の舞 阅读(192) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页