
西西里水题(水到爆阿)
文章平均质量分 67
Rest
这个作者很懒,什么都没留下…
展开
-
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 评论 -
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 评论 -
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 评论 -
1930. 排序
1930. 排序Description我们都知道,在排序算法中需要进行多次比较。若比较的两个数Ai, Aj(iAj的话,则称作有效比较。给定一个有N个互异元素的整数序列,请使用选择排序对序列进行排序,并输出其有效比较次数。这里假设使用的是标准的排序算法,并且从下标小到大的顺序进行枚举。比如,给定序列[4,1,3,2],选择排序的有效比较按顺序有(4,1), (4,3),原创 2011-12-21 13:49:12 · 1018 阅读 · 0 评论 -
3836. 计算组合数
3836. 计算组合数Description从n个不同物品中选出m个的选法总数用组合数C(n, m)来表示. 已知n和m,求C(n, m)的值.Input输入包含多组测试数据.输入的每行是两个整数n和m(0m和n都为0时表示输入结束.Output输出的每行是一个C(n, m)的值.Sampl原创 2011-12-13 21:55:48 · 629 阅读 · 0 评论 -
3835. 计算三角形的周长
3835. 计算三角形的周长Description在平面直角坐标系中,给出三角形三个顶点的坐标,求三角形的周长.Input第一行是一个整数T,表示总共有T组数据.接下来的T行,每行有6个实数x1, y1, x2, y2, x3, y3,表示三角形三个顶点的坐标.Output每行输出一个三角形的周长,小数点后保留5位原创 2011-12-13 21:57:17 · 937 阅读 · 0 评论 -
3499. 分数统计
3499. 分数统计Description某校举行歌手大赛. 大赛设m位评委,每位评委都会给参赛歌手打分,每个分数都在0~100的范围内. 统计分数的规则是去掉一个最高分和一个最低分,取剩下分数的平均值. 编写程序完成分数统计.Input第一行是一个整数T,表示总共有T组数据.每组数据的第一行是整数m(3接下来一行有m个整数,分别是每位评委对歌手原创 2011-12-13 22:03:50 · 582 阅读 · 0 评论 -
1963. Max Integer
1963. Max IntegerDescriptionGiven a set of n integers: A = {a1, a2,..., an}, calculate the max integer in the set.InputThe first line is an integer n (1 OutputThe max i原创 2011-12-14 00:17:27 · 541 阅读 · 0 评论 -
1960. Sum of 1 to n
1960. Sum of 1 to nDescription Calculate 1 + 2 + 3 + ... + n (n is an integer, and 1 InputThe first line is an integer m, indicating the number of test cases.Then follow m line原创 2011-12-14 00:20:57 · 680 阅读 · 0 评论 -
1510. Mispelling
1510. MispellingDescriptionMisspelling is an art form that students seem to excel at. Write a program that removes the nth character from an input string.InputThe first line of input c原创 2011-12-14 00:33:00 · 1037 阅读 · 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 评论 -
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 评论 -
3712. Matrix multiplication
3712. Matrix multiplication Total:565Accepted:127Rating:2.0/5.0(1 votes)012345原创 2011-12-13 21:59:58 · 1258 阅读 · 0 评论 -
3498. 分解质因数
3498. 分解质因数Description对于输入的整数n,将其分解成若干个素数的乘积.Input第一行是一个整数T,表示总共有T组数据.接下来的T行,每行有一个整数n(2Output对于每行的整数n,按从小到大的顺序输出素因子,每个素因子后面有一个空格.Sample Input3100534S原创 2011-12-13 22:05:04 · 817 阅读 · 0 评论 -
1817. 校歌手大奖赛
1817. 校歌手大奖赛Description校歌手大奖赛中每个评委会给每个参赛选手打分,请用类描述每个选手的被评委的评分。选手得分规则为去掉一个最高分和一个最低分,然后计算平均得分,请编程输出某选手的得分。 Input输入数据有多组,第一行为数据组数T每组数据第一行两个正整数 n m (3 接下来 n 行,每行 m 个正整数。每行表示一个评原创 2011-12-14 00:23:33 · 1089 阅读 · 1 评论 -
1815. 计算两点间的距离
1815. 计算两点间的距离Description请用类描述顶点信息,输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。 Input输入数据第一行一个整数 n,代表测试数据组数,接下来 n 行,每行由 4 个实数组成,分别表示 x1,y1,x2,y2,数据之间用空格隔开。 Output对于每组测试数据,输出一原创 2011-12-14 00:25:02 · 822 阅读 · 0 评论 -
1765. 笨小猴
1765. 笨小猴Description笨小猴的词汇量很小,所以每次做英语选择题的时候都很头疼。但是他找到了一种方法,经试验证明,用这种方法去选择选项的时候选对的几率非常大!这种方法的具体描述如下:假设maxn是单词中出现次数最多的字母的出现次数,minn是单词中出现次数最少的字母的出现次数,如果maxn-minn是一个质数,那么笨小猴就认为这是个Lucky Word,这样原创 2011-12-14 00:28:17 · 1294 阅读 · 0 评论 -
1623. Sixth Grade Math
1623. Sixth Grade MathDescriptionIn sixth grade, students are presented with different ways to calculate the Least Common Multiple (LCM) and the Greatest Common Factor (GCF) of two integ原创 2011-12-14 00:30:49 · 1065 阅读 · 0 评论 -
4315. Digit Count
4315. Digit Count Total:526Accepted:228Rating:2.0/5.0(2 votes) Time Limit: 1se原创 2011-12-13 15:38:38 · 849 阅读 · 0 评论 -
4314. Coprime
4314. CoprimeDescriptionIn number theory, a branch of mathematics, two integers a and b are said to be coprime or relatively prime if the only positive integer that evenly divides both of them is原创 2011-12-13 15:41:51 · 659 阅读 · 0 评论 -
4312. A + B
4312. A + BDescriptionInput two integers a and b, output reverse(a)+reverse(b). reverse(a) is a new number reverse from a. For example , reverse(10)=1,reverse(123)=321.InputThe first line co原创 2011-12-13 15:43:55 · 559 阅读 · 0 评论 -
3913. 阶乘之和
3913. 阶乘之和Description计算S=1!+2!+3!+...+n!的末6位(不含前导0). 这里n!表示前n个正整数的相乘积.Input输入整数n(1Output输出1!+2!+3!+...+n!的末6位(不含前导0).Sample Input10Sample Output37913 // source code of su原创 2011-12-13 15:52:26 · 882 阅读 · 0 评论 -
3734. rawMo(这不是个题呀)
3734. rawMoInput22 1Output22// source code of submission 997829, Zhongshan University Online Judge System#include using namespace std;int main(){ int a,b; cin >>原创 2011-12-13 21:58:34 · 1276 阅读 · 0 评论 -
3497. 水仙花数
3497. 水仙花数Description若三位数ABC满足ABC=A3+B3+C3,则称ABC为水仙花数. 例如153就是一个水仙花数. 编程找出100~999范围内的所有水仙花数.Input无Output输出所有水仙花数,每个水仙花数占一行.Problem Source林瀚// source code原创 2011-12-13 22:07:14 · 1332 阅读 · 0 评论 -
2405. Mirror, Mirror on the Wall
2405. Mirror, Mirror on the WallDescriptionFor most fonts, the lowercase letters b and d are mirror images of each other, as are the letters p and q. Furthermore, letters i, o, v, w, and x原创 2011-12-13 22:13:35 · 1059 阅读 · 0 评论 -
2403. Voting
2403. VotingDescriptionA committee clerk is good at recording votes, but not so good at counting and figuring the outcome correctly. As a roll call vote proceeds, the clerk records votes as原创 2011-12-13 22:15:32 · 692 阅读 · 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 评论 -
3980. 二进制转十进制
3980. 二进制转十进制Description输入一个非负的二进制整数,将其转为十进制.Input输入的第一行是一个整数T,表示总共有T组数据.接下来的T行,每行是一组数据,每组数据是一个只包含字符0和1的字符串,代表待转换的二进制数,字符串的长度不大于31.Output对于每个二进制数,输出其对应的十进制数,每个数占一行. 注意输出的十进制不要有多余的前导0原创 2011-12-13 15:50:39 · 720 阅读 · 0 评论 -
3912. 计算星期几
3912. 计算星期几Description2011年1月1日是星期六. 输入2011年的一个日期,计算这一天是星期几.Input输入的第一行是一个正整数T,表示总共有T组数据.每组数据包括两个正整数m和d,表示输入日期为m月d日. 输入的日期保证合法.Output每组数据输出一行,表示对应的日期是星期几.Sample Input311 81原创 2011-12-13 15:54:20 · 703 阅读 · 0 评论 -
3496. 鸡兔同笼
3496. 鸡兔同笼Description一个笼中有x只鸡和y只兔(x和y可以为0). 它们总共有m个头和n只脚(0 ). 从键盘读入m和n的值,从屏幕输出x和y的值. 如果无解,则输出No answer.Input有多组输入数据. 输入数据的每行是两个整数m和n. m和n都为0表示输入结束(不需要处理这一行).Output对于每组输原创 2011-12-13 22:07:58 · 705 阅读 · 0 评论 -
2683. Alice and Bob
2683. Alice and BobDescriptionBob is very famous because he likes to play games. Today he puts a chessboard in the desktop, and plays a game with Alice. The size of the chessboard is n by n.原创 2011-12-13 22:10:58 · 1416 阅读 · 0 评论 -
2001. Scavenger Hunt
2001. Scavenger HuntDescriptionFarmer John has scattered treats for Bessie at special places in the pasture. Since everyone knows that smart cows make tasty milk, FJ has placed the treats at原创 2011-12-14 00:15:49 · 719 阅读 · 0 评论 -
1962. Username Validation
1962. Username ValidationDescription A website requests its new user to register a user name before using it. A valid (有效的) username should: (1) Contain only letters (a~z, A~Z) and digits原创 2011-12-14 00:18:44 · 698 阅读 · 0 评论 -
1959. 1-Norm Distance
1959. 1-Norm DistanceDescription For two points with coordinates (坐标) of (x1, y1) and (x2, y2), their 1-norm distance D1 is defined as: D1 = |x1 – x2| + |y1 – y2|. Calculate the 1-norm dista原创 2011-12-14 00:22:38 · 1177 阅读 · 0 评论 -
1798. Alice and Bob
1798. Alice and BobDescriptionBob is very famous because he likes to play games. Today he puts a chessboard in the desktop, and plays a game with Alice. The size of the chessboard is n by原创 2011-12-14 00:26:31 · 1718 阅读 · 0 评论 -
1561. PRIME
1561. PRIMEDescriptionA prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. The first prime number is 2. Can you write a program that compu原创 2011-12-14 00:31:53 · 1002 阅读 · 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 评论 -
1306. Sorting Algorithm
1306. Sorting AlgorithmDescriptionOne of the fundamental problems of computer science is ordering a list of items. There're a plethora of solutions to this problem, known as sorting algorithms.原创 2011-12-14 10:17:56 · 891 阅读 · 0 评论 -
1293. 3n+1数链问题
1293. 3n+1数链问题Description在计算机科学上,有很多类问题是无法解决的,我们称之为不可解决问题。然而,在很多情况我们并不知道哪一类问题可以解决,那一类问题不可解决。现在我们就有这样一个问题,问题如下:1. 输入一个正整数n;2. 把n显示出来;3. 如果n=1则结束;4. 如果n是奇数则n变为3n+1原创 2011-12-14 13:38:55 · 1199 阅读 · 0 评论