
模拟
小·幸·运
你的所有努力最后都会回赠予你。
展开
-
PAT乙级B1010- 一元多项式求导 (25)(25 分)
设计函数求一元多项式的导数。(注:x^n^(n为整数)的一阶导数为n*x^n-1^。)输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是0,但是表示为“0 0”。输入样例:3 4 -5 2 6 ...原创 2018-05-18 21:48:49 · 484 阅读 · 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...原创 2018-08-22 21:48:02 · 275 阅读 · 0 评论 -
PAT甲级A1042 Shuffling Machine(20 分)
Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "inside jobs" where employees collaborate with gambler...原创 2018-08-31 21:56:41 · 232 阅读 · 0 评论 -
PAT甲级A1049 Counting Ones (30 分)
The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1's i...原创 2019-01-18 18:36:54 · 294 阅读 · 0 评论 -
PAT甲级A1116 Come on! Let's C (20 分)
"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as...原创 2019-03-01 16:48:36 · 154 阅读 · 0 评论 -
PAT乙级B1052 卖个萌 (20 分)
萌萌哒表情符号通常由“手”、“眼”、“口”三个主要部分组成。简单起见,我们假设一个表情符号是按下列格式输出的:[左手]([左眼][口][右眼])[右手]现给出可选用的符号集合,请你按用户的要求输出表情。输入格式:输入首先在前三行顺序对应给出手、眼、口的可选符号集。每个符号括在一对方括号 []内。题目保证每个集合都至少有一个符号,并不超过 10 个符号;每个符号包含 1 到 4 ...原创 2019-03-03 19:35:13 · 162 阅读 · 0 评论 -
PAT乙级B1073 多选题常见计分法 (20 分)
批改多选题是比较麻烦的事情,有很多不同的计分方法。有一种最常见的计分方法是:如果考生选择了部分正确选项,并且没有选择任何错误选项,则得到 50% 分数;如果考生选择了任何一个错误的选项,则不能得分。本题就请你写个程序帮助老师批改多选题,并且指出哪道题的哪个选项错的人最多。输入格式:输入在第一行给出两个正整数 N(≤1000)和 M(≤100),分别是学生人数和多选题的个数。随后 M 行,每...原创 2019-03-06 20:44:05 · 292 阅读 · 0 评论 -
PAT甲级A1129 Recommendation System (25 分)
Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user's preference by the number of time...原创 2019-03-09 16:39:20 · 208 阅读 · 0 评论 -
PAT乙级B1058 选择题 (20 分)
批改多选题是比较麻烦的事情,本题就请你写个程序帮助老师批改多选题,并且指出哪道题错的人最多。输入格式:输入在第一行给出两个正整数 N(≤ 1000)和 M(≤ 100),分别是学生人数和多选题的个数。随后 M 行,每行顺次给出一道题的满分值(不超过 5 的正整数)、选项个数(不少于 2 且不超过 5 的正整数)、正确选项个数(不超过选项个数的正整数)、所有正确选项。注意每题的选项从小写英文...原创 2019-03-04 15:35:34 · 277 阅读 · 0 评论 -
PAT乙级B1090 危险品装箱 (25 分)
集装箱运输货物时,我们必须特别小心,不能把不相容的货物装在一只箱子里。比如氧化剂绝对不能跟易燃液体同箱,否则很容易造成爆炸。本题给定一张不相容物品的清单,需要你检查每一张集装箱货品清单,判断它们是否能装在同一只箱子里。输入格式:输入第一行给出两个正整数:N (≤104) 是成对的不相容物品的对数;M (≤100) 是集装箱货品清单的单数。随后数据分两大块给出。第一块有 N 行...原创 2019-03-14 20:29:30 · 417 阅读 · 0 评论 -
PAT甲级A1153 Decode Registration Card of PAT (25 分)
A registration card number of PAT consists of 4 parts:the 1st letter represents the test level, namely, T for the top level, A for advance and B for basic; the 2nd - 4th digits are the test site nu...原创 2019-03-15 21:10:08 · 290 阅读 · 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...原创 2018-08-18 21:54:53 · 166 阅读 · 0 评论 -
PAT甲级A1017 Queueing at Bank (25)
Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow li...原创 2018-08-03 21:32:14 · 176 阅读 · 0 评论 -
PAT甲级A1014 Waiting in Line (30)
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The space...原创 2018-07-29 16:21:24 · 184 阅读 · 0 评论 -
2018复旦大学计算机硕士招生复试上机题(2)-解一元一次方程
题目要求: 解方程,给定一个字符串,代表一个一元一次方程。如果有解求解,输出格式“x=数字“,如果解的个数无穷,输出 “infinite solutions”。如果没有解输出“no solution”字符串长度不超过 256 。样例:输入:10x-2x-8=4x+7+x输出:x=5 思路:1.解题原则,解题步骤中应当尽量减少逻辑思考,可以多设置几个参数,数组。简...原创 2018-05-19 20:37:54 · 4588 阅读 · 4 评论 -
PAT乙级B1012- 数字分类 (20)(20 分)
给定一系列正整数,请按要求对数字进行分类,并输出以下5个数字:A1 = 能被5整除的数字中所有偶数的和;A2 = 将被5除后余1的数字按给出顺序进行交错求和,即计算n1-n2+n3-n4...;A3 = 被5除后余2的数字的个数;A4 = 被5除后余3的数字的平均数,精确到小数点后1位;A5 = 被5除后余4的数字中最大数字。输入格式:每个输入包含1个测试用例。每个测试用例先给出一个不超过1000...原创 2018-05-20 17:08:18 · 143 阅读 · 0 评论 -
PAT乙级B1014 福尔摩斯的约会 (20)(20 分)
大侦探福尔摩斯接到一张奇怪的字条:“我们约会吧! 3485djDkxh4hhGE2984akDfkkkkggEdsb s&hgsfdkd&Hyscvnm”。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间“星期四14:04”,因为前面两字符串中第1对相同的大写英文字母(大小写有区分)是第4个字母'D',代表星期四;第2对相同的字符是'E',那是第5个英文字母,代表一天里的第...原创 2018-05-21 20:21:06 · 237 阅读 · 0 评论 -
PAT乙级B1017 A除以B (20)(20 分)
本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A= B * Q + R成立。输入格式:输入在1行中依次给出A和B,中间以1空格分隔。输出格式:在1行中依次输出Q和R,中间以1空格分隔。输入样例:123456789050987654321 7输出样例:17636684150141093474 3作者: CHEN, Yue单位: PAT联盟时间...原创 2018-05-22 19:49:27 · 324 阅读 · 0 评论 -
PAT乙级B1018 锤子剪刀布 (20)
大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。输入格式:输入第1行给出正整数N(<=10^5^),即双方交锋的次数。随后N行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C代表“锤子”、J代表“剪刀”、B代表“布”,第1个字母代表甲方,第2个代表乙方,中间有1个空格。输...原创 2018-05-22 22:03:19 · 133 阅读 · 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 contains...原创 2018-07-16 21:27:16 · 228 阅读 · 0 评论 -
PATB1027 打印沙漏(20)
本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印***** *** * ********所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。给定任意N个符号,不一定能正好组成一个沙漏。要求打印出的沙漏能用掉尽可能多的符号。输入格式:...原创 2018-07-24 21:31:03 · 176 阅读 · 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...原创 2018-07-19 22:17:57 · 151 阅读 · 0 评论 -
PAT乙级B1024 科学计数法 (20)
科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+-][0-9]+,即数字的整数部分只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出。现以科学计数法的格式给出实数A,请编写程序按普通数字表示法输出A,并保证所有有效位都被保留。输入格式:每个输入包含1个测试用例,即一个以科学计数法表示的实...原创 2018-07-20 21:48:42 · 197 阅读 · 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...原创 2018-07-20 22:15:07 · 143 阅读 · 0 评论 -
PAT乙级B1089 狼人杀-简单版 (20 分)
以下文字摘自《灵机一动·好玩的数学》:“狼人杀”游戏分为狼人、好人两大阵营。在一局“狼人杀”游戏中,1 号玩家说:“2 号是狼人”,2 号玩家说:“3 号是好人”,3 号玩家说:“4 号是狼人”,4 号玩家说:“5 号是好人”,5 号玩家说:“4 号是好人”。已知这 5 名玩家中有 2 人扮演狼人角色,有 2 人说的不是实话,有狼人撒谎但并不是所有狼人都在撒谎。扮演狼人角色的是哪两号玩家?本题...原创 2019-03-13 17:41:21 · 445 阅读 · 0 评论