- 博客(15)
- 资源 (1)
- 收藏
- 关注
转载 PAT1012. The Best Rank
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - Eng
2013-03-17 22:27:20
672
原创 PAT1011. World Cup Betting
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. S
2013-03-17 18:58:14
619
原创 PAT1009. Product of Polynomials
This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa
2013-03-16 15:53:56
647
原创 PAT1008. Elevator
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec
2013-03-16 15:14:30
678
原创 PAT1007. Maximum Subsequence Sum
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. TheMaximum Subsequence is the continuous subsequence w
2013-03-16 15:02:19
666
原创 PAT1006. Sign In and Sign Out
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, yo
2013-03-15 15:58:19
676
原创 PAT1005.Spell It Right
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Eac
2013-03-15 15:35:35
677
原创 PAT1002.A+B for Polynomials
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polyn
2013-03-15 14:58:44
641
原创 PAT1001.A+B Format
Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input file contains
2013-03-15 14:42:02
697
原创 PAT中文版1005.继续(3n+1)猜想
卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算3、5、8、4、2、1,则当我们对n=5、8、4、2进行验证的时候,就可以直接判定卡拉兹猜想的真伪,而不需要重复计算,因为这4个数已经在验证3的时候遇到过了,我们称5、8、4、2是被3“
2013-03-14 21:57:59
2303
原创 PAT中文版1004.成绩排名
读入n名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含1个测试用例,格式为 第1行:正整数n 第2行:第1个学生的姓名 学号 成绩 第3行:第2个学生的姓名 学号 成绩 ... ... ... 第n+1行:第n个学生的姓名 学号 成绩其中姓名和学号均为不超过10个字符的字符串,成绩为0到100之间的一个整数
2013-03-14 21:50:50
1830
原创 PAT中文版1003.我要通过!
“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符;2. 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串;3
2013-03-14 21:29:31
6801
原创 PAT中文版1002.写出这个数
读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10100。 输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1空格,但一行中最后一个拼音数字后没有空格。 输入样例:1234567890987654321123456789 输出样例:yi san wu
2013-03-14 21:13:18
2510
原创 PAT中文版1001.害死人不偿命的(3n+1)猜想
卡拉兹(Callatz)猜想:对任何一个自然数n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把(3n+1)砍掉一半。这样一直反复砍下去,最后一定在某一步得到n=1。卡拉兹在1950年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学生们无心学业,一心只证(3n+1),以至于有人说这是一个阴谋,卡拉兹是在蓄意延缓美国数学界教学与科
2013-03-14 21:03:10
1631
原创 关于求解素数(C/C++,perl)
对于素数字,大家都很熟悉了。凡是学习编程的都写过判断素数的程序。我们从最简单的开始,依次深入。 首先是教科书中的方法,这种方法的思路比较简单,给定一个数num,从2--(num-1),一直实验,若其中某个数字能被num整除,说明num不是素数,返回false,反之,则这个数是素数。很简单的方法,符合素数的基本定义,代码清单如下: bool prime(
2012-12-01 13:26:49
742
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人