自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Ecloss

我们都在阴沟里,但仍有人仰望星空。

  • 博客(50)
  • 收藏
  • 关注

原创 PAT:A1047 Student List for Course (25 分)

PAT:A1047 Student List for Course (25 分)Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the stude...

2018-08-29 15:09:50 283

原创 PAT:A1046 Shortest Distance (20 分)

PAT:A1046 Shortest Distance (20 分)The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input S...

2018-08-29 15:09:01 273

原创 PAT:A1044 Shopping in Mars (25 分)

PAT:A1044 Shopping in Mars (25 分)Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, th...

2018-08-27 13:01:34 337

原创 PAT:A1041 Be Unique (20 分)

PAT:A1041 Be Unique (20 分)Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​4​...

2018-08-27 13:00:35 283

原创 PAT:A1039 Course List for Student (25 分)

PAT:A1039 Course List for Student (25 分)Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the register...

2018-08-27 12:59:37 227

原创 PAT:A1038 Recover the Smallest Number (30 分)

PAT:A1038 Recover the Smallest Number (30 分)Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can r...

2018-08-27 12:58:34 337

原创 PAT:B1029 旧键盘(20 分)

PAT:B1029 旧键盘(20 分)旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及实际被输入的文字,请你列出肯定坏掉的那些键。输入格式:输入在 2 行中分别给出应该输入的文字、以及实际被输入的文字。每段文字是不超过 80 个字符的串,由字母 A-Z(包括大、小写)、数字 0-9、以及下划线 _(代表空格)组成。题目保证 2 个字符串...

2018-08-27 12:57:34 362

原创 PAT:B1028 人口普查(20 分)

PAT:B1028 人口普查(20 分)某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过 200 岁的老人,而今天是 2014 年 9 月 6 日,所以超过 200 岁的生日和未出生的生日都是不合理的,应该被过滤掉。输入格式:输入在第一行给出正整数 N,取值在(0,10​...

2018-08-27 12:56:43 259

原创 PAT:B1027 打印沙漏(20 分)

PAT:B1027 打印沙漏(20 分)本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印***** *** * ********所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。给定任意N个符号,不一定能正好组成一个沙漏。要求打印出的...

2018-08-27 12:55:52 252

原创 PAT:B1026 程序运行时间(15 分)

PAT:B1026 程序运行时间(15 分)要获得一个 C 语言程序的运行时间,常用的方法是调用头文件 time.h,其中提供了 clock() 函数,可以捕捉从程序开始运行到 clock() 被调用时所耗费的时间。这个时间单位是 clock tick,即“时钟打点”。同时还有一个常数 CLK_TCK,给出了机器时钟每秒所走的时钟打点数。于是为了获得一个函数 f 的运行时间,我们只要在调用 f...

2018-08-27 12:54:14 274

原创 PAT:A1036 Boys vs Girls (25 分)

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:...

2018-08-27 12:53:17 365

原创 PAT:A1031 Hello World for U (20 分)

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 rlowo...

2018-08-27 12:52:20 316

原创 PAT:A1028 List Sorting (25 分)

PAT:A1028 List Sorting (25 分)Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each ca...

2018-08-22 10:11:08 250

原创 PAT:A1027 Colors in Mars (20 分)

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 dig...

2018-08-22 10:10:11 217

原创 PAT:B1023 组个最小数

PAT:B1023 组个最小数给定数字 0-9 各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意 0 不能做首位)。例如:给定两个 0,两个 1,三个 5,一个 8,我们得到的最小的数就是 10015558。现给定数字,请编写程序输出能够组成的最小的数。输入格式:输入在一行中给出 10 个非负整数,顺序表示我们拥有数字 0、数字 1、……...

2018-08-22 10:08:01 251

原创 PAT:A1025 PAT Ranking (25 分)

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 sever...

2018-08-21 10:22:02 264

原创 PAT:A1024 Palindromic Number (25 分)

PAT:A1024 Palindromic Number (25 分)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 ...

2018-08-21 10:21:02 354

原创 PAT:B1022 D进制的A+B(20 分)

PAT:B1022 D进制的A+B(20 分)输入两个非负 10 进制整数 A 和 B (≤2​30​​−1),输出 A+B 的 D (1<D≤10)进制数。输入格式:输入在一行中依次给出 3 个整数 A、B 和 D。输出格式:输出 A+B 的 D 进制数。输入样例:123 456 8输出样例:1103 代码:C/C++:#incl...

2018-08-21 10:20:07 265

原创 PAT:B1021 个位数统计(15 分)

PAT:B1021 个位数统计(15 分)给定一个 k 位整数 N=d​k−1​​10​k−1​​+⋯+d​1​​10​1​​+d​0​​ (0≤d​i​​≤9, i=0,⋯,k−1, d​k−1​​>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定 N=100311,则有 2 个 0,3 个 1,和 1 个 3。输入格式:每个输入包含 1 个测试用例,即一个不超过 ...

2018-08-21 10:19:05 449 1

原创 PAT:B1020 月饼(25 分)

PAT:B1020 月饼(25 分)月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有 3 种月饼,其库存量分别为 18、15、10 万吨,总售价分别为 75、72、45 亿元。如果市场的最大需求量只有 20 万...

2018-08-21 10:18:14 288

原创 PAT:B1019 数字黑洞(20 分)

PAT:B1019 数字黑洞(20 分)给定任一个各位数字不完全相同的 4 位正整数,如果我们先把 4 个数字按非递增排序,再按非递减排序,然后用第 1 个数字减第 2 个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的 6174,这个神奇的数字也叫 Kaprekar 常数。例如,我们从6767开始,将得到7766 - 6677 = 10899810 -...

2018-08-21 10:17:22 607

原创 PAT:B1018 锤子剪刀布(20 分)

PAT:B1018 锤子剪刀布(20 分)大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。输入格式:输入第 1 行给出正整数 N(≤10​5​​),即双方交锋的次数。随后 N 行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C 代表“锤子”、J代表“剪刀”、...

2018-08-21 10:16:29 382

原创 PAT:A1023 Have Fun with Numbers (20 分)

PAT:A1023 Have Fun with Numbers (20 分)Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which ...

2018-08-21 10:15:35 251

原创 PAT:B1017 A除以B(20 分)

PAT:B1017 A除以B(20 分)本题要求计算 A/B,其中 A 是不超过 1000 位的正整数,B 是 1 位正整数。你需要输出商数 Q 和余数 R,使得 A=B×Q+R 成立。输入格式:输入在一行中依次给出 A 和 B,中间以 1 空格分隔。输出格式:在一行中依次输出 Q 和 R,中间以 1 空格分隔。输入样例:123456789050987654321 7...

2018-08-21 10:14:24 397

原创 PAT:B1016 部分A+B(15 分)

PAT:B1016 部分A+B(15 分)正整数 A 的“D​A​​(为 1 位整数)部分”定义为由 A 中所有 D​A​​ 组成的新整数 P​A​​。例如:给定 A=3862767,D​A​​=6,则 A 的“6 部分”P​A​​ 是 66,因为 A 中有 2 个 6。现给定 A、D​A​​、B、D​B​​,请编写程序计算 P​A​​+P​B​​。输入格式:输入在一行中依次给出 ...

2018-08-21 10:13:28 350

原创 PAT:A1016 Phone Bills (25 分)

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 d...

2018-08-20 09:26:42 562

原创 [PAT-乙级]B1015 德才论(25 分)

PAT:B1015 德才论(25 分)宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。”现给出一批考生的德才分数,请根据司马光的理论给出录取排名。输入格式:输入第一行给出 3 个正整数,分别为:N(≤10​5​​),即考生总数;L(≥60),...

2018-08-20 09:25:39 228

原创 PAT:A1015 Reversible Primes (20 分)

PAT:A1015 Reversible Primes (20 分)A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime...

2018-08-20 09:24:38 256

原创 PAT:A1012 The Best Rank (25 分)

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...

2018-08-20 09:23:47 750

原创 PAT:A1011 World Cup Betting (20 分)

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 ...

2018-08-20 09:22:54 483

原创 PAT:A1009 Product of Polynomials (25 分)

PAT:A1009 Product of Polynomials (25 分)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 ...

2018-08-20 09:21:56 338

原创 PAT:A1008 Elevator (20 分)

PAT:A1008 Elevator (20 分)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 spec...

2018-08-20 09:21:02 237

原创 PAT:A1006 Sign In and Sign Out (25 分)

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...

2018-08-17 13:43:43 440

原创 PAT:A1005 Spell It Right

PAT:A1005 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 ...

2018-08-17 13:41:57 317

原创 PAT:A1002 A+B for Polynomials (25 分)

PAT:A1002 A+B for Polynomials (25 分)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 lin...

2018-08-17 13:40:56 545

原创 [PAT-乙级]B1014 福尔摩斯的约会(20 分)

PAT:B1014 福尔摩斯的约会(20 分)大侦探福尔摩斯接到一张奇怪的字条:我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间星期四 14:04,因为前面两字符串中第 1 对相同的大写英文字母(大小写有区分)是第 4 个字母 D,代表星期四;第 2...

2018-08-17 13:39:44 565 1

原创 PAT:A1001 A+B Format (20 分)

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).Inpu...

2018-08-17 13:38:32 379

原创 [PAT-乙级]B1013 数素数(20 分)

PAT:B1013 数素数(20 分)令 P​i​​ 表示第 i 个素数。现任给两个正整数 M≤N≤10​4​​,请输出 P​M​​ 到 P​N​​ 的所有素数。输入格式:输入在一行中给出 M 和 N,其间以空格分隔。输出格式:输出从 P​M​​ 到 P​N​​ 的所有素数,每 10 个数字占 1 行,其间以空格分隔,但行末不得有多余空格。输入样例:5 27输出...

2018-08-17 13:37:14 521

原创 [PAT-乙级]B1012 数字分类(20 分)

PAT:B1012 数字分类(20 分)给定一系列正整数,请按要求对数字进行分类,并输出以下 5 个数字:A​1​​ = 能被 5 整除的数字中所有偶数的和; A​2​​ = 将被 5 除后余 1 的数字按给出顺序进行交错求和,即计算 n​1​​−n​2​​+n​3​​−n​4​​⋯; A​3​​ = 被 5 除后余 2 的数字的个数; A​4​​ = 被 5 除后余 3 的数字的平...

2018-08-17 13:36:16 318

原创 [PAT-乙级]B1011 A+B 和 C(15 分)

PAT:B1011 A+B 和 C(15 分)给定区间 [−2​31​​,2​31​​] 内的 3 个整数 A、B 和 C,请判断 A+B 是否大于 C。输入格式:输入第 1 行给出正整数 T (≤10),是测试用例的个数。随后给出 T 组测试用例,每组占一行,顺序给出 A、B 和 C。整数间以空格分隔。输出格式:对每组测试用例,在一行中输出 Case #X: true 如果 ...

2018-08-17 13:35:24 235

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除