PAT
文章平均质量分 77
jolivan
这个作者很懒,什么都没留下…
展开
-
PAT B1028. 人口普查(20)
某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过200岁的老人,而今天是2014年9月6日,所以超过200岁的生日和未出生的生日都是不合理的,应该被过滤掉。输入格式:输入在第一行给出正整数N,取值在(0, 105];随后N行,每行给出1个人的姓名(由不超过5个英文原创 2017-02-04 20:27:32 · 263 阅读 · 0 评论 -
PAT B1032. 挖掘机技术哪家强(20)
为了用事实说明挖掘机技术到底哪家强,PAT组织了一场挖掘机技能大赛。现请你根据比赛结果统计出技术最强的那个学校。输入格式:输入在第1行给出不超过105的正整数N,即参赛人数。随后N行,每行给出一位参赛者的信息和成绩,包括其所代表的学校的编号(从1开始连续编号)、及其比赛成绩(百分制),中间以空格分隔。输出格式:在一行中给出总得分最高的学校的编号、及其总分,中间以空格原创 2017-02-04 20:37:42 · 343 阅读 · 0 评论 -
PAT A1011. World Cup Betting (20)
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. Si原创 2017-02-04 22:07:22 · 185 阅读 · 0 评论 -
PAT A1006. Sign In and Sign Out (25)
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, you原创 2017-02-04 22:39:57 · 255 阅读 · 0 评论 -
PAT A1036. Boys vs Girls (25)
This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains o原创 2017-02-04 23:09:57 · 266 阅读 · 0 评论 -
PAT B1036. 跟奥巴马一起编程(15)
美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧!输入格式:输入在一行中给出正方形边长N(3输出格式:输出由给定字符C画出的正方形。但是注意到行间距比列间距大,所以为了让结果看上去更像正方形原创 2017-02-05 09:13:54 · 208 阅读 · 0 评论 -
PAT B1027. 打印沙漏(20)
本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印***** *** * ********所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。给定任意N个符号,不一定能正好组成一个沙漏。要求打印出的沙漏能用掉尽可能多的符号。输入原创 2017-02-05 10:52:07 · 195 阅读 · 0 评论 -
PAT B1023. 组个最小数 (20)
给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。现给定数字,请编写程序输出能够组成的最小的数。输入格式:每个输入包含1个测试用例。每个测试用例在一行中给出10个非负整数,顺序表示我们拥有数字0、数字1、……数字9的个数。原创 2017-01-15 10:27:59 · 346 阅读 · 0 评论 -
PAT A1031. Hello World for U (20)
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:h de ll rlowoThat is, the characters must be pr原创 2017-02-06 15:51:21 · 231 阅读 · 0 评论 -
PAT B1037. 在霍格沃茨找零钱(20)
如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱P和他实付的钱A,你的任务是写一个程序来计算他应该被找的零钱。输入格式:输入在1行中分别给出P和A,格式为“Galleon.Sickle.Knut”,其间用1个空格分隔。原创 2017-02-06 16:56:00 · 245 阅读 · 0 评论 -
PAT A1019. General Palindromic Number (20)
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers原创 2017-02-06 17:10:27 · 189 阅读 · 0 评论 -
PAT A1027. Colors in Mars (20)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 dig原创 2017-02-06 22:17:37 · 185 阅读 · 0 评论 -
PAT A1058. A+B in Hogwarts (20)
If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Si原创 2017-02-06 22:29:36 · 252 阅读 · 0 评论 -
PAT B1006. 换个格式输出整数 (15)
让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(输入格式:每个测试输入包含1个测试用例,给出正整数n(输出格式:每个测试用例的输出占一行,用规定的格式输出n。输入样例1:234输出样例1:BBSSS1234输入样例2:23输出样例2:SS123#include #include #include #i原创 2017-02-06 22:39:43 · 222 阅读 · 0 评论 -
PAT B1021. 个位数统计 (15)
给定一个k位整数N = dk-1*10k-1 + ... + d1*101 + d0 (0i<=9, i=0,...,k-1, dk-1>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N = 100311,则有2个0,3个1,和1个3。输入格式:每个输入包含1个测试用例,即一个不超过1000位的正整数N。输出格式:对N中每一种不同的个位数字,以D:原创 2017-02-06 22:49:37 · 220 阅读 · 0 评论 -
PAT B1031. 查验身份证(15)
一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下:首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值:Z:0 1 2 3 4 5 6 7 8 9 10M:1 0 X 9 8 7 6 5 4 3 2原创 2017-02-07 01:07:14 · 173 阅读 · 0 评论 -
PAT B1002. 写出这个数 (20)
读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10100。输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321123456789输出样例:yi san wu原创 2017-02-07 01:34:32 · 201 阅读 · 0 评论 -
PAT A1061. Dating (20)
Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a minute to figure out that those strange strings are a原创 2017-02-07 11:28:55 · 233 阅读 · 0 评论 -
PAT A1073. Scientific Notation (20)
Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9]"."[0-9]+E[+-][0-9]+ which means that the in原创 2017-02-07 15:32:47 · 292 阅读 · 0 评论 -
PAT B1048. 数字加密(20)
本题要求实现一种数字加密方法。首先固定一个加密用正整数A,对任一正整数B,将其每1位数字与A的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对13取余——这里用J代表10、Q代表11、K代表12;对偶数位,用B的数字减去A的数字,若结果为负数,则再加10。这里令个位为第1位。输入格式:输入在一行中依次给出A和B,均为不超过100位的正整数,其间以空格分隔。输出格原创 2017-02-07 16:16:37 · 254 阅读 · 0 评论 -
PAT A1001. A+B Format (20)
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 cont原创 2017-02-07 17:04:26 · 242 阅读 · 0 评论 -
PAT A1005. Spell It Right (20)
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.原创 2017-02-07 17:16:32 · 191 阅读 · 0 评论 -
PAT A1035. Password (20)
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L原创 2017-02-07 17:47:05 · 247 阅读 · 0 评论 -
PAT A1077. Kuchiguse (20/17)
The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called原创 2017-02-07 21:44:06 · 254 阅读 · 0 评论 -
PAT A1025. PAT Ranking (25)
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists w原创 2017-01-08 11:31:49 · 303 阅读 · 0 评论 -
PAT A1082. Read Number in Chinese (25/21)
Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output "Fu" first if it is negative. For example, -123456789 is read as "Fu yi Yi er Qian san B原创 2017-02-07 23:34:58 · 280 阅读 · 0 评论 -
PAT A1062. Talent and Virtue (25)
About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man being outstanding in both talent and virt原创 2017-02-08 12:01:51 · 245 阅读 · 0 评论 -
PAT B1020. 月饼 (25)
月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有3种月饼,其库存量分别为18、15、10万吨,总售价分别为75、72、45亿元。如果市场的最大需求量只有20万吨,那么我们最大收益策略应该是卖出全部15万吨第2种月饼、以原创 2017-01-13 10:13:34 · 316 阅读 · 0 评论 -
PAT A1012. The Best Rank (25)
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 Algebra), and E - Eng原创 2017-02-09 12:51:03 · 206 阅读 · 0 评论 -
PAT A1016. Phone Bills (25)
A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. Wh原创 2017-02-09 16:35:12 · 384 阅读 · 0 评论 -
PAT A1030. Travel Plan (30)
A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path b原创 2017-02-27 18:37:12 · 244 阅读 · 0 评论 -
PAT A1093. Count PAT's (25)
The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.No原创 2017-01-19 10:33:06 · 249 阅读 · 0 评论 -
PAT A1028. List Sorting (25)
Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N原创 2017-02-09 18:35:44 · 190 阅读 · 0 评论 -
PAT A1055. The World's Richest (25)
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl原创 2017-02-09 19:15:41 · 226 阅读 · 0 评论 -
PAT A1075. PAT Judge (25)
The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input fil原创 2017-02-09 21:29:19 · 213 阅读 · 0 评论 -
PAT A1083. List Grades (25)
Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades原创 2017-02-09 23:11:45 · 198 阅读 · 0 评论 -
PAT A1033. To Fill or Not to Fill (25)
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different ga原创 2017-02-19 01:23:36 · 261 阅读 · 0 评论 -
PAT A1108. Finding Average (20/17)
The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be legal. A "legal" input is a re原创 2017-02-28 12:25:57 · 287 阅读 · 0 评论 -
PAT A1037. Magic Coupon (25)
The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product b原创 2017-02-19 10:19:05 · 335 阅读 · 0 评论 -
PAT A1085. Perfect Sequence (25)
Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M Now given a sequence and a parameter p, you are supposed to find from the原创 2017-02-19 16:04:35 · 236 阅读 · 0 评论