03 2017 档案
摘要:P1 : hiho密码 P1 : hiho密码 Time Limit:10000ms Case Time Limit:1000ms Memory Limit:256MB Description 小Ho根据最近在密码学课上学习到的知识,开发出了一款hiho密码,这款密码的秘钥是这样生成的:对于一种有N
阅读全文
摘要:旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及实际被输入的文字,请你列出肯定坏掉的那些键。 输入格式: 输入在2行中分别给出应该输入的文字、以及实际被输入的文字。每段文字是不超过80个字符的串,由字母A-Z(包括大、小写)、数字0-9、以及下划线“
阅读全文
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F
阅读全文
摘要:Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popula
阅读全文
摘要:Give a natural number n (1 <= n <= 500000), please tell the summation of all its proper divisors. Definition: A proper divisor of a natural number is
阅读全文
摘要:Among grandfather��s papers a bill was found: 72 turkeys $_679_ The first and the last digits of the number that obviously represented the total price
阅读全文
摘要:As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked t
阅读全文
摘要:1 typedef struct node{ 2 int val; 3 struct node *left, *right; 4 }TreeNode; 5 //求二叉树的节点个数。 6 int GetNodeNum(TreeNode *pRoot){ 7 if(pRoot == NULL) 8 return 0; 9 ...
阅读全文
摘要:题目1184:二叉树遍历 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4167 解决:1690 题目描述: 编一个程序,读入用户输入的一串先序遍历字符串,根据此字符串建立一个二叉树(以指针方式存储)。例如如下的先序遍历字符串:ABC##DE#G##F###其中“#”表示的是空格,空格字
阅读全文
摘要:In Zhejiang University, there is a famous BBS named Freecity. Usually we call it 88. Recently some students at the Humour board on 88 create a new gam
阅读全文
摘要:Superbowl Sunday is nearly here. In order to pass the time waiting for the half-time commercials and wardrobe malfunctions, the local hackers have org
阅读全文
摘要:Bill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunately, Bill ha
阅读全文
摘要:Roy has just moved into a new apartment.Well, actually the apartment itself is not very new, even dating back to the days before people had electricit
阅读全文
摘要:Given a list of monetary amounts in a standard format, please calculate the total amount. We define the format as follows: 1. The amount starts with '
阅读全文
摘要:J.P. Flathead's Grocery Store hires cheap labor to man the checkout stations. The people he hires (usually high school kids) often make mistakes makin
阅读全文
摘要:Zombies love to eat brains. Yum. Input The first line contains a single integer n indicating the number of data sets. The following n lines each repre
阅读全文
摘要:Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue liste
阅读全文
摘要:Mike is very lucky, as he has two beautiful numbers, 3 and 5. But he is so greedy that he wants infinite beautiful numbers. So he declares that any po
阅读全文
摘要:Prime Number Definition An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. For instance,
阅读全文
摘要:In recreational mathematics, a magic square of n-degree is an arrangement of n2 numbers, distinct integers, in a square, such that the n numbers in al
阅读全文
摘要:Given positive integers B and N, find an integer A such that AN is as close as possible to B. (The result A is an approximation to the Nth root of B.)
阅读全文
摘要:A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome becau
阅读全文
摘要:We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers
阅读全文
摘要:Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to this process
阅读全文
摘要:Our school is planning to hold a new exciting computer programming contest. During each round of the contest, the competitors will be paired, and comp
阅读全文
摘要:Jim is fond of reading books, and he has so many books that sometimes it's hard for him to manage them. So he is asking for your help to solve this pr
阅读全文
摘要:FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N
阅读全文
摘要:In the 22nd Century, scientists have discovered intelligent residents live on the Mars. Martians are very fond of mathematics. Every year, they would
阅读全文
摘要:A boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4
阅读全文
摘要:The daffodil number is one of the famous interesting numbers in the mathematical world. A daffodil number is a three-digit number whose value is equal
阅读全文
摘要:One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the
阅读全文
摘要:Tom has a meadow in his garden. He divides it into N * M squares. Initially all the squares were covered with grass. He mowed down the grass on some o
阅读全文
摘要:The image stored on a computer can be represented as a matrix of pixels. In the RGB (Red-Green-Blue) color system, a pixel can be described as a tripl
阅读全文
摘要:The Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies. Therefore the dramatic advi
阅读全文
摘要:Your chemistry lab instructor is a very enthusiastic graduate student who clearly has forgotten what their undergraduate Chemistry 101 lab experience
阅读全文
摘要:For each list of words, output a line with each word reversed without changing the order of the words. This problem contains multiple test cases! The
阅读全文
摘要:In most languages, text is written from left to right. However, there are other languages where text is read and written from right to left. As a firs
阅读全文
摘要:Mathematics can be so easy when you have a computer. Consider the following example. You probably know that in a right-angled triangle, the length of
阅读全文
摘要:Little Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. ``Look, I've built a wall!
阅读全文
摘要:BackgroundThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that dig
阅读全文
摘要:Uniform Resource Identifiers (or URIs) are strings like http://icpc.baylor.edu/icpc/, mailto:foo@bar.org, ftp://127.0.0.1/pub/linux, or even just read
阅读全文
摘要:When a Little White meets another Little White: Little White A: (Surprised) !Little White B: ?Little White A: You Little White know "SHDC"? So unbelie
阅读全文
摘要:The look and say sequence is defined as follows. Start with any string of digits as the first element in the sequence. Each subsequent element is defi
阅读全文
摘要:Given a string containing only 'A' - 'Z', we could encode it using the following method: 1. Each sub-string containing k same characters should be enc
阅读全文
摘要:Given a positive integer n, print out the positions of all 1's in its binary representation. The position of the least significant bit is 0. ExampleTh
阅读全文
摘要:You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or the film of the same name by Stanley Kubrick. In it a spaceship is sen
阅读全文
摘要:A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also
阅读全文
摘要:Description: 有一些01字串,将其按1的个数的多少的顺序进行输出。 Sample Input: 10011111 00001101 1010101 1 0 1100 Sample Output: 0 1 1100 00001101 1010101 10011111 1 #include
阅读全文
摘要:1、 请输入高度h,输入一个高为h,上底边长为h的等腰梯形(例如h=4,图形如下)。 **** ****** ******** **********
阅读全文
摘要:N个人围成一圈顺序编号,从1号开始按1、2、3顺序报数,报3者退出圈外,其余的人再从1、2、3开始报数,报3的人再退出圈外,依次类推。请按退出顺序输出每个退出人的原序号。要求使用环行链表编程。 模拟题。
阅读全文
摘要:题目1369:字符串的排列 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3257 解决:820 题目描述: 输入一个字符串,按字典序打印出该字符串中字符的所有排列。例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。 输
阅读全文
摘要:题目1371:最小的K个数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6646 解决:1417 题目描述: 输入n个整数,找出其中最小的K个数。例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,。 输入: 每个测试案例包括2行: 第一行为2个整数n,
阅读全文
摘要:题目1182:统计单词 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4780 解决:1764 题目描述: 编一个程序,读入用户输入的,以“.”结尾的一行文字,统计一共有多少个单词,并分别输出每个单词含有多少个字符。(凡是以一个或多个空格隔开的部分就为一个单词) 输入: 输入包括1行字符
阅读全文
摘要:题目1014:排名 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:9361 解决:2820 题目描述: 今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑每题的分值,所以并不是最后的排名。给定录取分数线,请你写程序找出最后通过分数线的考生,并将他们的
阅读全文
摘要:题目1180:对称矩阵 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3092 解决:1607 题目描述: 输入一个N维矩阵,判断是否对称。 输入: 输入第一行包括一个数:N(1<=N<=100),表示矩阵的维数。接下来的N行,每行包括N个数,表示N*N矩阵的元素。 输出: 可能有多组测
阅读全文
摘要:题目1192:回文字符串 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4391 解决:2082 题目描述: 给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的。 输入: 输入包括一行字符串,其长度不超过1000。 输出: 可能有多组测试数据,对于每组数据,如果是
阅读全文
摘要:题目1203:IP地址 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3636 解决:1800 题目描述: 输入一个ip地址串,判断是否合法。 输入: 输入的第一行包括一个整数n(1<=n<=500),代表下面会出现的IP地址的个数。 接下来的n行每行有一个IP地址,IP地址的形式为a.
阅读全文
摘要:题目1201:二叉排序树 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:7024 解决:2983 题目描述: 输入一系列整数,建立二叉排序数,并进行前序,中序,后序遍历。 输入: 输入第一行包括一个整数n(1<=n<=100)。 接下来的一行包括n个整数。 输出: 可能有多组测试数据,对
阅读全文
摘要:题目1202:排序 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:28802 解决:9408 题目描述: 对输入的n个数进行排序并输出。 输入: 输入的第一行包括一个整数n(1<=n<=100)。 接下来的一行包括n个整数。 输出: 可能有多组测试数据,对于每组数据,将排序后的n个整数输
阅读全文
摘要:题目1205:N阶楼梯上楼问题 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:4990 解决:2039 题目描述: N阶楼梯上楼问题:一次可以走两阶或一阶,问有多少种上楼方式。(要求采用非递归) 输入: 输入包括一个整数N,(1<=N<90)。 输出: 可能有多组测试数据,对于每组数据
阅读全文
摘要:题目1206:字符串连接 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:5117 解决:2373 题目描述: 不借用任何字符串库函数实现无冗余地接受两个字符串,然后把它们无冗余的连接起来。 输入: 每一行包括两个字符串,长度不超过100。 输出: 可能有多组测试数据,对于每组数据,不借
阅读全文
摘要:题目1190:大整数排序 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4142 解决:1867 题目描述: 对N个长度最长可达到1000的数进行排序。 输入: 输入第一行为一个整数N,(1<=N<=100)。接下来的N行每行有一个数,数的长度范围为1<=len<=1000。每个数都是一
阅读全文
摘要:题目1196:成绩排序 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5192 解决:1792 题目描述: 用一维数组存储学号和成绩,然后,按成绩排序输出。 输入: 输入第一行包括一个整数N(1<=N<=100),代表学生的个数。接下来的N行每行包括两个整数p和q,分别代表每个学生的学号
阅读全文
摘要:题目1525:子串逆序打印 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3124 解决:530 题目描述: 小明手中有很多字符串卡片,每个字符串中都包含有多个连续的空格,而且这些卡片在印刷的过程中将字符串的每个子串都打印反了,现在麻烦你帮小明将这些字符串中的子串修正过来,同时为了使卡
阅读全文
摘要:题目1516:调整数组顺序使奇数位于偶数前面 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:3416 解决:1091 题目描述: 输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有的奇数位于数组的前半部分,所有的偶数位于位于数组的后半部分,并保证奇数和奇数,偶数和偶数之间
阅读全文
摘要:题目1490:字符串链接 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:2610 解决:1321 题目描述: 不用strcat 函数,自己编写一个字符串链接函数MyStrcat(char dstStr[],charsrcStr[]) 输入: 两个字符串,字符串由小写字母组成。 输出:
阅读全文
摘要:题目1438:最小公倍数 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:2451 解决:2057 题目描述: 给定两个正整数,计算这两个数的最小公倍数。 输入: 输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数。 输出: 对于每个测试用例,给出这两个数的最小公倍数,每
阅读全文
摘要:题目1181:遍历链表 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3483 解决:1465 题目描述: 建立一个升序链表并遍历输出。 输入: 输入的每个案例中第一行包括1个整数:n(1<=n<=1000),接下来的一行包括n个整数。 输出: 可能有多组测试数据,对于每组数据,将n个整
阅读全文
摘要:题目1179:阶乘 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6120 解决:1785 题目描述: 输入n,求y1=1!+3!+...m!(m是小于等于n的最大奇数)y2=2!+4!+...p!(p是小于等于n的最大偶数)。 输入: 每组输入包括1个整数:n 输出: 可能有多组测试数
阅读全文
摘要:题目1077:最大序列和 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6435 解决:1931 题目描述: 给出一个整数序列S,其中有N个数,定义其中一个非空连续子序列T中所有数的和为T的“序列和”。对于S的所有非空连续子序列T,求最大的序列和。变量条件:N为正整数,N≤1000000
阅读全文
摘要:题目1075:斐波那契数列 时间限制:5 秒 内存限制:32 兆 特殊判题:否 提交:3641 解决:2100 题目描述: 编写一个求斐波那契数列的递归函数,输入n值,使用该递归函数,输出如样例输出的斐波那契数列。 输入: 一个整型数n 输出: 题目可能有多组不同的测试数据,对于每组输入数据,按题目
阅读全文
摘要:题目1074:对称平方数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6422 解决:2912 题目描述: 打印所有不超过n(n<256)的,其平方具有对称性质的数。 如11*11=121 输入: 无任何输入数据 输出:输出具有题目要求的性质的数。如果输出数据不止一组,各组数据之间以回
阅读全文
摘要:题目1073:杨辉三角形 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4634 解决:1966 题目描述: 输入n值,使用递归函数,求杨辉三角形中各个位置上的值。 输入: 一个大于等于2的整型数n 输出: 题目可能有多组不同的测试数据,对于每组输入数据,按题目的要求输出相应输入n的杨辉
阅读全文
摘要:题目1072:有多少不同的面值组合? 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3627 解决:1852 题目描述: 某人有8角的邮票5张,1元的邮票4张,1元8角的邮票6张,用这些邮票中的一张或若干张可以得到多少种不同的邮资? 输入: 题目没有任何输入 输出: 按题目的要求输出可以
阅读全文
摘要:题目1070:今年的第几天? 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6832 解决:3779 题目描述: 输入年、月、日,计算该天是本年的第几天。 输入: 包括三个整数年(1<=Y<=3000)、月(1<=M<=12)、日(1<=D<=31)。 输出: 输入可能有多组测试数据,对
阅读全文
摘要:题目1068:球的半径和体积 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6148 解决:2269 题目描述: 输入球的中心点和球上某一点的坐标,计算球的半径和体积 输入:球的中心点和球上某一点的坐标,以如下形式输入:x0 y0 z0 x1 y1 z1输出:输入可能有多组,对于每组输入
阅读全文
摘要:题目1064:反序数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5163 解决:3698 题目描述: 设N是一个四位数,它的9倍恰好是其反序数(例如:1234的反序数是4321)求N的值 输入: 程序无任何输入数据 输出: 输出题目要求的四位数,如果结果有多组,则每组结果之间以回车隔
阅读全文
摘要:题目1063:整数和 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4043 解决:2638 题目描述: 编写程序,读入一个整数N。若N为非负数,则计算N到2N之间的整数和;若N为一个负数,则求2N到N之间的整数和 输入: 一个整数N,N的绝对值小于等于1000 输出: 测试数据可能有多
阅读全文
摘要:题目1062:分段函数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3874 解决:2278 题目描述: 编写程序,计算下列分段函数y=f(x)的值。y=-x+2.5; 0<=x<2y=2-1.5(x-3)(x-3); 2<=x<4y=x/2-1.5; 4<=x<6 输入: 一个浮点数
阅读全文
摘要:题目1061:成绩排序 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:24473 解决:6960 题目描述: 有N个学生的数据,将学生数据按成绩高低排序,如果成绩相同则按姓名字符的字母序排序,如果姓名的字母序也相同则按照学生的年龄排序,并输出N个学生排序后的信息。 输入: 测试数据有多组
阅读全文
摘要:题目1060:完数VS盈数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6461 解决:2426 题目描述: 一个数如果恰好等于它的各因子(该数本身除外)子和,如:6=3+2+1。则称其为“完数”;若因子之和大于该数,则称其为“盈数”。求出2到60之间所有“完数”和“盈数”。 输入:
阅读全文
摘要:题目1058:反序输出 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:9677 解决:3495 题目描述: 输入任意4个字符(如:abcd), 并按反序输出(如:dcba) 输入: 题目可能包含多组用例,每组用例占一行,包含4个任意的字符。 输出: 对于每组输入,请输出一行反序后的字符串
阅读全文
摘要:题目1057:众数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:9744 解决:3263 题目描述: 输入20个数,每个数都在1-10之间,求1-10中的众数(众数就是出现次数最多的数,如果存在一样多次数的众数,则输出权值较小的那一个)。 输入: 测试数据有多组,每组输入20个1-10
阅读全文
摘要:题目1056:最大公约数 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8068 解决:5317 题目描述: 输入两个正整数,求其最大公约数。 输入: 测试数据有多组,每组输入两个正整数。 输出: 对于每组输入,请输出其最大公约数。 样例输入: 49 14 样例输出: 7 1 #incl
阅读全文
摘要:题目1055:数组逆置 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8225 解决:3932 题目描述: 输入一个字符串,长度小于等于200,然后将数组逆置输出。 输入: 测试数据有多组,每组输入一个字符串。 输出: 对于每组输入,请输出逆置后的结果。 样例输入: hdssg 样例输出
阅读全文
摘要:题目1054:字符串内排序 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:10985 解决:5869 题目描述: 输入一个字符串,长度小于等于200,然后将输出按字符顺序升序排序后的字符串。 输入: 测试数据有多组,输入字符串。 输出: 对于每组输入,输出处理后的结果。 样例输入: ba
阅读全文
摘要:题目1052:找x 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:9901 解决:5098 题目描述: 输入一个数n,然后输入n个数值各不相同,再输入一个值x,输出这个值在这个数组中的下标(从0开始,若不在数组中则输出-1)。 输入: 测试数据有多组,输入n(1<=n<=200),接着输
阅读全文
摘要:题目1047:素数判定 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:12466 解决:5644 题目描述: 给定一个数n,要求判断其是否为素数(0,1,负数都是非素数)。 输入: 测试数据有多组,每组输入一个数n。 输出: 对于每组输入,若是素数则输出yes,否则输入no。 样例输入:
阅读全文
摘要:卡拉兹(Callatz)猜想: 对任何一个自然数n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把(3n+1)砍掉一半。这样一直反复砍下去,最后一定在某一步得到n=1。卡拉兹在1950年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学
阅读全文