
刷题之旅
文章平均质量分 63
Rest
这个作者很懒,什么都没留下…
展开
-
1815. 计算两点间的距离(类实现)
Sicily 1815. 计算两点间的距离Description请用类描述顶点信息,输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。 Input输入数据第一行一个整数 n,代表测试数据组数,接下来 n 行,每行由 4 个实数组成,分别表示 x1,y1,x2,y2,数据之间用空格隔开。 O原创 2011-11-25 09:22:44 · 973 阅读 · 0 评论 -
987654321 problem
987654321 problemTime Limit:500MS Memory Limit:4096KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionFor given number N you must output amount of N-digit原创 2011-12-01 14:28:29 · 911 阅读 · 0 评论 -
Parencodings
ParencodingsTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionLet S = s1 s2...s2n be a well-formed string of parenthes原创 2011-12-01 19:13:46 · 808 阅读 · 0 评论 -
4495. Print permutations
4495. Print permutationsDescriptionA permutation is a possible ordering of a set. For example, the permutations of a set {A,B,C} include ABC, ACB, BAC, BCA, CAB, CBA.The number of permut原创 2011-12-17 11:21:13 · 1194 阅读 · 0 评论 -
1966. 卡片游戏
1966. 卡片游戏Description桌上有一叠牌,从第一张牌(即位于顶面的牌)开始从上往下依次编号为1~n。当至少还剩两张牌时进行以下操作:把第一张牌扔掉,然后把新的第一张放到整叠牌的最后。输入n,输出每次扔掉的牌,以及最后剩下的牌。 Input 第一行为一个整数t(0Output 为每个测试用例单独输出一行,该行中依次输出每次原创 2011-12-17 15:46:14 · 2000 阅读 · 0 评论 -
1485. Hanoi双塔问题
1485. Hanoi双塔问题Description给定A、B、C三根足够长的细柱,在A柱上放有2n个中间有孔的圆盘,共有n个不同的尺寸,每个尺寸都有两个相同的圆盘,注意这两个圆盘是不加区分的。现要将这些圆盘移到C柱上,在移动过程中可放在B柱上暂存。要求:(1)每次只能移动一个圆盘;(2)A、B、C三根细柱上的圆盘都要保持上小下大的顺序;任务:设An为2n个圆盘完成上述原创 2011-12-17 20:48:55 · 1968 阅读 · 0 评论 -
4424. David’s Lucky Numbers
4424. David’s Lucky NumbersDescriptionDavid loves lucky numbers. In his opinion, positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For exam原创 2011-12-20 11:09:57 · 880 阅读 · 0 评论 -
2501. 算算式
2501. 算算式Description_gXX遇到一个麻烦的式子:S = n1 + n2 + n3 + ...... + nk,已知n、k,求S的值。因为_gXX数学很差,希望你能告诉他答案。但是由于他的数学实在太差了,所以你只需要告诉他S除以9901的余数即可。Input两个整数,n和k(n ≤ 1000 , k ≤ 109)。O原创 2011-12-20 21:58:24 · 1694 阅读 · 2 评论 -
2010. H Number
2010. H NumberDescription Hengheng is a math nerd. Today he invents a new kind of numbers so called H number. These numbers satisfy that each digit is either the sum or the difference of the adj原创 2011-12-13 22:19:08 · 717 阅读 · 0 评论 -
1344. 数列
1344. 数列Description给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增的序列,例如,当k=3时,这个序列是: 1,3,4,9,10,12,13,… (该序列实际上就是:30,31,30+31,32,30+32,31+32,30+31+32,…) 请你求出这个序列的第N项的值(用10进制数表示)。 例如,对原创 2011-12-14 00:38:47 · 971 阅读 · 0 评论 -
1766. 火柴棒等式
1766. 火柴棒等式Description给你n根火柴棍,你可以拼出多少个形如“A+B=C”的等式?等式中的A、B、C是用火柴棍拼出的整数(若该数非零,则最高位不能是0)。用火柴棍拼数字0-9的拼法如图所示:注意:1. 加号与等号各自需要两根火柴棍2. 如果A≠B,则A+B=C与B+A=C视为不同的等式(A、B、C>=0)3. n根火柴棍必须全部用上Inp原创 2011-12-21 10:48:13 · 2306 阅读 · 0 评论 -
1930. 排序
1930. 排序Description我们都知道,在排序算法中需要进行多次比较。若比较的两个数Ai, Aj(iAj的话,则称作有效比较。给定一个有N个互异元素的整数序列,请使用选择排序对序列进行排序,并输出其有效比较次数。这里假设使用的是标准的排序算法,并且从下标小到大的顺序进行枚举。比如,给定序列[4,1,3,2],选择排序的有效比较按顺序有(4,1), (4,3),原创 2011-12-21 13:49:12 · 1018 阅读 · 0 评论 -
4422. Boat Game
4422. Boat GameDescriptionMirko has recently discovered an old video game. The screen of this game is divided into N columns.At the bottom of the screen, there is an M-columns-wide boat (M<N原创 2011-12-20 13:32:10 · 823 阅读 · 0 评论 -
1500. Prime Gap
1500. Prime GapDescriptionThe sequence of n ? 1 consecutive composite numbers (positive integers that are not prime and not equal to 1) lying between two successive prime numbers p and p +原创 2011-12-14 00:34:25 · 1172 阅读 · 0 评论 -
1021. Couples
1021. CouplesDescriptionN couples are standing in a circle, numbered consecutively clockwise from 1 to 2N. Husband and wife do not always stand together. We remove the couples who stand to原创 2011-12-22 13:53:29 · 2292 阅读 · 1 评论 -
1087. A Funny Game
1087. A Funny GameDescriptionAlice and Bob decide to play a funny game. At the beginning of the game they pick n(1 6) coins in a circle, as Figure 1 shows. A move consists in removing one or t原创 2011-12-14 13:59:39 · 796 阅读 · 0 评论 -
1001. Alphacode
1001. AlphacodeDescriptionAlice and Bob need to send secret messages to each other and are discussing ways to encode their messages: Alice: "Let's just use a very simple code: We'll assign `A'原创 2011-12-14 14:03:08 · 1076 阅读 · 0 评论 -
1194. Message Flood
1194. Message FloodDescriptionWell, how do you feel about mobile phone? Your answer would probably be something like that “It’s so convenient and benefits people a lot”. However, if you ask Me原创 2011-12-22 01:14:05 · 1866 阅读 · 0 评论 -
1198. Substring
1198. SubstringDescriptionDr lee cuts a string S into N pieces,s[1],…,s[N]. Now, Dr lee gives you these N sub-strings: s[1],…s[N]. There might be several possibilities that the string S co原创 2011-12-22 14:44:11 · 1797 阅读 · 0 评论 -
1007. To and Fro
1007. To and FroDescriptionMo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letters only) down the columns, pa原创 2011-12-14 14:01:52 · 2238 阅读 · 0 评论 -
1761. ISBN号码
1761. ISBN号码Description每一本正式出版的图书都有一个ISBN号码与之对应,ISBN码包括9位数字、1位识别码和3位分隔符,其规定格式如“x-xxx-xxxxx-x”,其中符号“-”是分隔符(键盘上的减号),最后一位是识别码,例如0-670-82162-4就是一个标准的ISBN码。ISBN码的首位数字表示书籍的出版语言,例如0代表英语;第一个分隔符“-”之后的三原创 2011-12-24 16:17:00 · 1744 阅读 · 0 评论 -
1636. show me the money
1636. show me the moneyDescriptionFakosh like playing the game "StarCraft". However, he is not so good at this game that he can't beat the AI. For victory, he typed "show me the money" to che原创 2011-12-24 16:52:28 · 949 阅读 · 0 评论 -
1634. Relax! It's just a game
1634. Relax! It's just a gameDescriptionYou: What's the score? Did I miss much?Me: It's 2-1 for elAhli and the second half just started. The first half was quite boring.You: Who sc原创 2011-12-24 17:24:47 · 1170 阅读 · 0 评论 -
1159. Sum
1159. SumDescriptionGiven several positive integers, calculate the sum of them.InputThere are several test cases, one line for each case. For each line, the first number, N (N100.Output原创 2011-12-25 11:30:02 · 808 阅读 · 0 评论 -
1342. 开心的金明
1342. 开心的金明Description金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间他自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过N元钱就行”。今天一早金明就开始做预算,但是他想买的东西太多了,肯定会超过妈妈限定的N元。于是,他把每件物品规定了一个重要度,分为5等:用整数1~5表示,第5等最重要。原创 2011-12-26 00:18:21 · 8065 阅读 · 2 评论 -
1701. Cannonball Pyramids
1701. Cannonball PyramidsDescriptionIf you visit historical battlegrounds from periods when cannon were used, you may see cannonballs (metal spheres) stacked in various ways. In this probl原创 2011-12-24 16:42:53 · 661 阅读 · 0 评论 -
2005. Lovely Number
2005. Lovely NumberDescriptionEvery time after got a solution from kevin, ivan repeats again and again,"Are there any better ones?". It seems more worse this time. Given a sequence of numbers,原创 2011-12-23 19:55:30 · 973 阅读 · 0 评论 -
1763. 传球游戏
1763. 传球游戏Description上体育课的时候,小蛮的老师经常带着同学们一起做游戏。这次,老师带着同学们一起做传球游戏。 游戏规则是这样的:n个同学站成一个圆圈,其中的一个同学手里拿着一个球,当老师吹哨子时开始传球,每个同学可以把球传给自己左右的两个同学中的一个(左右任意),当老师再次吹哨子时,传球停止,此时,拿着球没传出去的那个同学就是败者,要给大家表演一个节目原创 2011-12-24 16:19:19 · 862 阅读 · 0 评论 -
1381. a*b
1381. a*bTotal:4745Accepted:1275Rating:2.7/5.0(26 votes)012345 Time Limit: 1sec Memory Limit:32原创 2011-12-16 20:02:58 · 935 阅读 · 0 评论 -
1031. Campus
1031. CampusDescriptionAt present, Zhongshan University has 4 campuses with a total area of 6.17 square kilometers sitting respectively on both sides of the Pearl River or facing the South Chi原创 2011-12-27 20:32:16 · 1328 阅读 · 0 评论 -
1482. 奖学金
1482. 奖学金Description某小学最近得到了一笔赞助,打算拿出其中一部分为学习成绩优秀的前5名学生发奖学金。期末,每个学生都有3门课的成绩:语文、数学、英语。先按总分从高到低排序,如果两个同学总分相同,再按语文成绩从高到低排序,如果两个同学总分和语文成绩都相同,那么规定学号小的同学排在前面,这样,每个学生的排序是唯一确定的。任务:先根据输入的3门课的成绩计算转载 2011-12-27 21:47:19 · 1270 阅读 · 0 评论 -
1027. MJ, Nowhere to Hide
1027. MJ, Nowhere to HideDescriptionOn BBS, there is a familiar term called MJ (short for MaJia), which means another BBS ID of one person besides his/her main ID.These days, a lot of AC原创 2011-12-26 15:27:52 · 1967 阅读 · 0 评论 -
1036. Crypto Columns
1036. Crypto ColumnsDescriptionThe columnar encryption scheme scrambles the letters in a message (or plaintext) using a keyword as illustrated in the following example: Suppose BATBOY is t原创 2011-12-26 16:47:23 · 1490 阅读 · 0 评论 -
1438. Shopaholic
1438. ShopaholicDescriptionLindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only pay for two, she goes completely mad and feels a need to b原创 2011-12-26 20:12:17 · 1081 阅读 · 0 评论 -
1146. 采药
1146. 采药Description辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给他出了一个难题。医师把他带到一个到处都是草药的山洞里对他说:“孩子,这个山洞里有一些不同的草药,采每一株都需要一些时间,每一株也有它自身的价值。我会给你一段时间,在这段时间里,你可以采到一些草药。如果你是一个聪明的孩子,原创 2011-12-26 21:24:43 · 1010 阅读 · 0 评论 -
1201. 01000001
1201. 01000001DescriptionAdding binary numbers is a very simple task, and very similar to the longhand addition of decimal numbers. As with decimal numbers, you start by adding the bits (d原创 2011-12-26 22:04:09 · 1281 阅读 · 0 评论 -
1134. 积木分发
1134. 积木分发Description歌手The Pancakes到幼儿园跟小朋友玩耍,她到达的时候小朋友们已经争着积木玩了。小朋友都想要更多的积木砌一个自己喜欢的图形,砌完就可以和The Pancakes合照。同时,The Pancakes手上还有一些积木,她可以把手上的这些积木全部给一个小朋友,然后等该小朋友砌完后就可以收回所发的积木和该小朋友原先手上的积木。但她不原创 2011-12-26 18:10:31 · 1733 阅读 · 1 评论 -
1211. 商人的宣传
1211. 商人的宣传邻接矩阵强大不解释:http://zh.wikipedia.org/wiki/%E9%82%BB%E6%8E%A5%E7%9F%A9%E9%98%B5Description Bruce是K国的商人,他在A州成立了自己的公司,这次他的公司生产出了一批性能很好的产品,准备宣传活动开始后的第L天到达B州进行新品拍卖,期间Bruce打算将产品拿原创 2011-12-27 16:55:21 · 1649 阅读 · 0 评论 -
1323. Switch text
1323. Switch textDescriptionThe program must switch the text lines in a backward order and split them by the middle, processing the input lines in pairs. If an empty or blank line is found原创 2011-12-27 18:14:54 · 1094 阅读 · 0 评论 -
2038. String Reversion
2038. String ReversionDescription Given a valid identifier in C programs, please write a program to reverse it by respectively reversing two parts separated by ‘_’.Input The firs原创 2011-12-27 22:58:12 · 1183 阅读 · 1 评论