自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

克拉拉的博客

个人LEETCODE\PAT\OJ算法题解,知识见解

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

原创 PAT.B1023. 组个最小数

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

2018-03-31 22:25:45 99

原创 PAT.B1020. 月饼

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

2018-03-31 22:13:15 93

转载 《挑战编程》 Programming challenge (UVaOJ 112道题目)

 第一章:入门         1.1 PC/UVa 题号: 110101/100  The 3n+1 problem (3n+1 问题)           1.2 PC/UVa 题号: 110102/10189 Minesweeper (扫雷)           1.3 PC/UVa 题号: 110103/10137 The Trip (旅行)           1.4 PC/UVa 题号...

2018-03-29 01:54:33 619

原创 OPENJUDGE 1007:点评赛车

总时间限制: 1000ms内存限制: 65536kB描述4名专家对4款赛车进行评论1)A说:2号赛车是最好的;2)B说:4号赛车是最好的;3)C说:3号赛车不是最好的;4)D说: B说错了。事实上只有1款赛车最佳,且只有1名专家说对了,其他3人都说错了。请编程输出最佳车的车号,以及说对的专家。输入无输入。输出输出两行。第一行输出最佳车的车号(1-4中的某个数字)。第二行输出说对的专家(A-D中的某...

2018-03-29 01:49:54 214

原创 OPENJUDGE 1689 数组逆序重放

总时间限制: 1000ms内存限制: 65536kB描述将一个数组中的值按逆序重新存放。例如,原来的顺序为8,6,5,4,1。要求改为1,4,5,6,8。输入输入为两行:第一行数组中元素的个数n(1<n<100),第二行是n个整数,每两个整数之间用空格分隔。输出输出为一行:输出逆序后数组的整数,每两个整数之间用空格分隔。样例输入58 6 5 4 1样例输出1 4 5 6 8#incl...

2018-03-29 01:12:54 296

原创 PAT.A1048. Find Coins

Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,...

2018-03-25 02:00:51 113

原创 PAT.B1005. 继续(3n+1)猜想

卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算3、5、8、4、2、1,则当我们对n=5、8、4、2进行验证的时候,就可以直接判定卡拉兹猜想的真伪,而不需要重复计算,因为这4个数已经在验证3的时候遇到过了,我们称5、8、4、2是被3“覆盖...

2018-03-25 00:54:50 115

原创 PAT.A1050. String Subtraction

Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However, i...

2018-03-24 23:18:33 85

原创 PAT.A1041. Be Unique

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, 104]. The first one who bets on ...

2018-03-24 19:07:51 61

原创 PAT.B1043. 输出PATest

给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按“PATestPATest....”这样的顺序输出,并忽略其它字符。当然,六种字符的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按PATest的顺序打印,直到所有字符都被输出。输入格式:输入在一行中给出一个长度不超过10000的、仅由英文字母构成的非空字符串。输出格式:在一行中按题目要求输出排序后的字符...

2018-03-21 02:36:13 92

原创 PAT.B1042. 字符统计

请编写程序,找出一段给定文字中出现最频繁的那个英文字母。输入格式:输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成,至少包含1个英文字母,以回车结束(回车不算在内)。输出格式:在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如果有并列,则输出按字母序最小的那个字母。统计时不区分大小写,输出小写字母。输入样例:This is a si...

2018-03-20 17:30:29 102

原创 PAT.A1092. To Buy or Not to Buy

Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sel...

2018-03-20 01:20:05 147

原创 PAT.A1038. 统计同成绩学生

本题要求读入N名学生的成绩,将获得某一给定分数的学生人数输出。输入格式:输入在第1行给出不超过105的正整数N,即学生总人数。随后1行给出N名学生的百分制整数成绩,中间以空格分隔。最后1行给出要查询的分数个数K(不超过N的正整数),随后是K个分数,中间以空格分隔。输出格式:在一行中按查询顺序给出得分等于指定分数的学生人数,中间以空格分隔,但行末不得有多余空格。输入样例:1060 75 90 55...

2018-03-20 00:59:46 116

原创 PAT.A.1033. 旧键盘打字

旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及坏掉的那些键,打出的结果文字会是怎样?输入格式:输入在2行中分别给出坏掉的那些键、以及应该输入的文字。其中对应英文字母的坏键以大写给出;每段文字是不超过105个字符的串。可用的字符包括字母[a-z, A-Z]、数字0-9、以及下划线“_”(代表空格)、“,”、“.”、“-”、“+”(代表上档键)。题目...

2018-03-20 00:52:27 95

原创 PAT.A1084. Broken Keyboard

On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a string that you are supposed to t...

2018-03-19 23:53:12 110

原创 PAT.A1095. Cars on Campus

Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you a...

2018-03-19 00:03:18 128

原创 PAT.A1080. Graduate Admission

It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admissio...

2018-03-17 16:22:24 135

原创 PAT.a1083. List Grades

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

2018-03-16 03:49:28 105

原创 PAT.A1075. PAT Judge

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

2018-03-15 22:35:49 140

原创 PAT.A1055. The World's Richest

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

2018-03-15 03:35:57 203

原创 pat A1028. List Sorting

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 (<=1...

2018-03-14 21:34:48 110

原创 PAT.A1016. Phone Bills

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

2018-03-13 22:10:23 96

原创 PAT.1012. 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 Algebra), and E - Eng...

2018-03-11 02:21:38 69

原创 PAT.1062. Talent and Virtue

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

2018-03-10 03:17:11 72

原创 PAT a1025. PAT Ranking

https://www.patest.cn/contests/pat-a-practise/1025Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run sim...

2018-03-05 21:08:43 109

原创 PAT1082. Read Number in Chinese

https://www.patest.cn/contests/pat-a-practise/1082Given 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 exam...

2018-03-03 22:23:34 129

空空如也

空空如也

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

TA关注的人

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