字符串处理
小魚兒.
天下皆白,唯我独黑!
展开
-
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 · 95 阅读 · 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 · 101 阅读 · 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 · 92 阅读 · 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 · 122 阅读 · 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 · 78 阅读 · 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 · 144 阅读 · 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 · 100 阅读 · 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 · 115 阅读 · 0 评论 -
3.6 PAT B 1002 写出这个数 (20分)(字符串处理)
1002 写出这个数 (20分)读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含 1 个测试用例,即给出自然数 n 的值。这里保证 n 小于 10100。输出格式:在一行内输出 n 的各位数字之和的每一位,拼音数字间有 1 空格,但一行中最后一个拼音数字后没有空格。输入样例:12345678909876543211...原创 2020-03-04 15:57:06 · 85 阅读 · 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 · 117 阅读 · 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 · 78 阅读 · 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 · 122 阅读 · 0 评论 -
3.6 PAT B1009 说反话 (20分)(字符串处理)
1009 说反话 (20分)给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用 1 个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:...原创 2020-02-22 16:08:17 · 116 阅读 · 0 评论