快乐模拟
文章平均质量分 60
小魚兒.
天下皆白,唯我独黑!
展开
-
PAT 1042 Shuffling Machine
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 gamblers by performing inadequate shuffles, many casinos employ原创 2022-05-21 10:36:25 · 192 阅读 · 0 评论 -
PAT 1028 人口普查
某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过 200 岁的老人,而今天是 2014 年 9 月 6 日,所以超过 200 岁的生日和未出生的生日都是不合理的,应该被过滤掉。输入格式:输入在第一行给出正整数N,取值在(0,105];随后N行,每行给出 1 个人的姓名(由不超过 5 个英文字母组成的字符串)、以及按yyyy/mm/dd(即年/月/日)格式给出的生日。题目保证最年...原创 2022-05-21 10:21:13 · 64 阅读 · 0 评论 -
3.6 PAT A1082 Read Number in Chinese (25分)
1082 Read Number in Chinese (25分)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 i...原创 2020-03-10 15:37:57 · 102 阅读 · 0 评论 -
3.6 PAT A1077 Kuchiguse (20分)(公共后缀)
1077 Kuchiguse (20分)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...原创 2020-03-10 15:26:22 · 109 阅读 · 0 评论 -
3.6 PAT A1035 Password (20分)(修改字符串)
1035 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 distingui...原创 2020-03-09 16:00:32 · 97 阅读 · 0 评论 -
3.6 PAT A1005 Spell It Right (20分)(大数各位和)
1005 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 ...原创 2020-03-09 15:12:02 · 126 阅读 · 0 评论 -
3.6 PAT A1001 A+B Format (20分)(数的,分法)
1001 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).Input Spec...原创 2020-03-07 16:05:06 · 84 阅读 · 0 评论 -
3.6 PAT B1048 数字加密 (20分)(字符串处理)
1048 数字加密 (20分)本题要求实现一种数字加密方法。首先固定一个加密用正整数 A,对任一正整数 B,将其每 1 位数字与 A 的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对 13 取余——这里用 J 代表 10、Q 代表 11、K 代表 12;对偶数位,用 B 的数字减去 A 的数字,若结果为负数,则再加 10。这里令个位为第 1 位。输入格式:输入在一行中依次...原创 2020-03-06 16:38:36 · 152 阅读 · 0 评论 -
3.6 PAT A1073 Scientific Notation (20分)(科学计数法——字符串处理)
1073 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[+-]...原创 2020-03-06 15:42:50 · 104 阅读 · 0 评论 -
3.6 PAT A 1061 Dating (20分)(字符串处理)
1061 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 th...原创 2020-03-05 16:52:49 · 120 阅读 · 0 评论 -
3.6 PAT B 1002 写出这个数 (20分)(字符串处理)
1002 写出这个数 (20分)读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含 1 个测试用例,即给出自然数 n 的值。这里保证 n 小于 10100。输出格式:在一行内输出 n 的各位数字之和的每一位,拼音数字间有 1 空格,但一行中最后一个拼音数字后没有空格。输入样例:12345678909876543211...原创 2020-03-04 15:57:06 · 90 阅读 · 0 评论 -
3.6 PAT A1031 查验身份证 (15分)(字符串处理)
1031 查验身份证 (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...原创 2020-03-04 15:48:01 · 126 阅读 · 0 评论 -
3.6 PAT B1021 个位数统计 (15分)(字符统计)
1021 个位数统计 (15分)给定一个 k 位整数 N=dk−110k−1+⋯+d1101+d0 (0≤di≤9, i=0,⋯,k−1, dk−1>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定 N=100311,则有 2 个 0,3 个 1,和 1 个 3。输入格式:每个输入包含 1 个测试用例,即一个不超过 1000 ...原创 2020-03-04 15:02:26 · 84 阅读 · 0 评论 -
3.6 PAT B1006 换个格式输出整数 (15分)(字符串处理)
1006 换个格式输出整数 (15分)让我们用字母 B 来表示“百”、字母 S 表示“十”,用 12...n 来表示不为零的个位数字 n(<10),换个格式来输出任一个不超过 3 位的正整数。例如 234 应该被输出为 BBSSS1234,因为它有 2 个“百”、3 个“十”、以及个位的 4。输入格式:每个测试输入包含 1 个测试用例,给出正整数 n(<1000)。输出...原创 2020-03-04 14:46:22 · 130 阅读 · 0 评论 -
3.5 PAT A1058 A+B in Hogwarts (20分)(进制转换)
1058 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 a...原创 2020-03-03 16:12:11 · 111 阅读 · 0 评论 -
3.5 PAT A1027 Colors in Mars (20分)(进制转换)
1027 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 ar...原创 2020-03-03 15:15:38 · 97 阅读 · 0 评论 -
3.5 PAT A1019 General Palindromic Number (20分)(进制转换)
1019 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 singl...原创 2020-03-03 14:39:45 · 86 阅读 · 0 评论 -
3.5 PAT B1037 在霍格沃茨找零钱 (20分)(进制转换)
1037 在霍格沃茨找零钱 (20分)如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱 P 和他实付的钱 A,你的任务是写一个程序来计算他应该被找的零钱。输入格式:输入在 1 行中分别给出 P 和 A,格式为 Galleo...原创 2020-03-01 15:52:38 · 188 阅读 · 0 评论 -
3.3 PAT A1031 Hello World for U (20分)(图形输出)
1031 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 rlowoTha...原创 2020-03-01 15:08:50 · 97 阅读 · 0 评论 -
3.3 PAT B1027 打印沙漏 (20分)(图形输出)
1027 打印沙漏 (20分)本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印***** *** * ********所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。给定任意N个符号,不一定能正好组成一个沙漏。要求打印出的沙漏...原创 2020-03-01 15:05:55 · 205 阅读 · 0 评论 -
3.2 PAT A 1036 Boys vs Girls (25分)(
1036 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...原创 2020-03-01 14:46:03 · 101 阅读 · 0 评论 -
3.2 PAT A1006 Sign In and Sign Out (25分)(比较最大最小型)
1006 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 recor...原创 2020-02-29 16:41:59 · 78 阅读 · 0 评论 -
3.2 PAT A1011 World Cup Betting (20分)(查找元素)
1011 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 ...原创 2020-02-29 15:41:44 · 89 阅读 · 0 评论 -
3.2 PAT B1028 人口普查 (20分)(查找元素)
1028 人口普查 (20分)某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过 200 岁的老人,而今天是 2014 年 9 月 6 日,所以超过 200 岁的生日和未出生的生日都是不合理的,应该被过滤掉。输入格式:输入在第一行给出正整数 N,取值在(0,105];...原创 2020-02-29 15:02:41 · 101 阅读 · 0 评论 -
3.2 PAT B1004 成绩排名 (20分)(查找元素)
1004 成绩排名 (20分)读入 n(>0)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含 1 个测试用例,格式为第 1 行:正整数 n第 2 行:第 1 个学生的姓名 学号 成绩第 3 行:第 2 个学生的姓名 学号 成绩 ... ... ...第 n+1 行:第 n 个学生的姓名 学号 成绩其中姓...原创 2020-02-28 16:12:17 · 124 阅读 · 0 评论 -
3.2 PAT B1041 考试座位号 (15分)(查找元素——哈希)
1041 考试座位号 (15分)每个 PAT 考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试座位号码。输入格式:输入第一行给出一个正整数 N(≤...原创 2020-02-28 15:55:42 · 174 阅读 · 0 评论 -
3.1 PAT A1009 Product of Polynomials (25分)(多项式乘法)
1009 Product of Polynomials (25分)This time, you are supposed to find A×BA\times BA×B where AAA and BBB are two polynomials.Input Specification:Each input file contains one test case. Each case o...原创 2020-02-28 15:24:20 · 141 阅读 · 0 评论 -
3.1 PAT A1002 A+B for Polynomials (25分)(多项式加法——哈希)
1002 A+B for Polynomials (25分)This time, you are supposed to find A+BA+BA+B where AAA and BBB are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2...原创 2020-02-27 16:37:43 · 110 阅读 · 0 评论 -
3.1 PAT B1010 一元多项式求导 (25分)(哈希)
1010 一元多项式求导 (25分)设计函数求一元多项式的导数。(注:xn(n为整数)的一阶导数为nxn−1。)输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过 1000 的整数)。数字间以空格分隔。输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是 0,但是表示...原创 2020-02-27 15:25:41 · 114 阅读 · 0 评论 -
3.1 PAT A 1065 A+B and C (64bit) (20分) (大整数运算)
1065 A+B and C (64bit) (20分)Given three integers A, B and C in [−263,263], you are supposed to tell whether A+B>C.Input Specification:The first line of the input gives the positive numb...原创 2020-02-26 16:21:52 · 116 阅读 · 0 评论 -
3.1 PAT A1046 Shortest Distance (20分)
1046 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 Specifi...原创 2020-02-26 15:41:50 · 119 阅读 · 0 评论 -
Hdu 1037Keep on Truckin'
Keep on Truckin'Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21500Accepted Submission(s): 14260Problem DescriptionBoudreaux and ...原创 2020-02-25 16:33:24 · 127 阅读 · 0 评论 -
3.1 PAT1018 锤子剪刀布 (20分)
1018 锤子剪刀布 (20分)大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。输入格式:输入第 1 行给出正整数 N(≤105),即双方交锋的次数。随后 N 行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C 代表“锤子”、J 代表“剪刀”、B 代表...原创 2020-02-25 15:08:47 · 75 阅读 · 0 评论 -
3.1 PAT B1012 数字分类 (20分)
1012 数字分类 (20分)给定一系列正整数,请按要求对数字进行分类,并输出以下 5 个数字:A1 = 能被 5 整除的数字中所有偶数的和;A2 = 将被 5 除后余 1 的数字按给出顺序进行交错求和,即计算 n1−n2+n3−n4⋯;A3 = 被 5 除后余 2 的数字的个数;A4 = 被 5 除后余 3 的数字的平均数,精确到小数点后...原创 2020-02-24 15:41:06 · 85 阅读 · 0 评论 -
3.1 PAT B1008 数组元素循环右移问题 (20分)
1008 数组元素循环右移问题 (20分)一个数组AAA中存有NNN(>0>0>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移MMM(≥0\ge 0≥0)个位置,即将AAA中的数据由(A0A1⋯AN−1A_0 A_1 \cdots A_{N-1}A0A1⋯AN−1)变换为(AN−M⋯AN−1A0A1⋯AN−M−1A_{N-M} \cdots ...原创 2020-02-24 15:12:45 · 144 阅读 · 0 评论 -
3.1 PAT B1046 划拳 (15分)
1046 划拳 (15分)划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就赢了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。下面给出甲、乙两人的划拳记录,请你统计他们最后分别喝了多少杯酒。输入格式:输入第一行先给出一个正整数 N(≤100),随后 ...原创 2020-02-23 16:14:42 · 101 阅读 · 0 评论 -
3.1 PAT B1016 部分A+B (15分)
1016 部分A+B (15分)正整数 AAA 的“DAD_ADA(为 1 位整数)部分”定义为由 AAA 中所有 DAD_ADA 组成的新整数 PAP_APA。例如:给定 A=3862767A = 3862767A=3862767,DA=6D_A = 6DA=6,则 AAA 的“6 部分”PAP_APA 是 66,因为 AAA 中有 2 个 6。现给定 AA...原创 2020-02-23 15:57:06 · 147 阅读 · 0 评论 -
3.1 PAT1011 A+B 和 C (15分)
1011 A+B 和 C (15分)给定区间 [−231,231] 内的 3 个整数 A、B 和 C,请判断 A+B 是否大于 C。输入格式:输入第 1 行给出正整数 T (≤10),是测试用例的个数。随后给出 T 组测试用例,每组占一行,顺序给出 A、B 和 C。整数间以空格分隔。输出格式:对每组测试用例,在一行中输出 Case #X: true 如果 A+B&g...原创 2020-02-23 15:32:39 · 188 阅读 · 0 评论 -
3.6 PAT B1009 说反话 (20分)(字符串处理)
1009 说反话 (20分)给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用 1 个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:...原创 2020-02-22 16:08:17 · 120 阅读 · 0 评论 -
3.6 Code Up 5901: 【字符串】回文串
5901: 【字符串】回文串[Creator : Imported]Time Limit : 1.000 secMemory Limit : 128 MBSolved: 2105Submit: 2105StatisticsDescription读入一串字符,判断是否是回文串。“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。In...原创 2020-02-22 15:28:32 · 98 阅读 · 0 评论