pat 1023 Have Fun with Numbers(20 分)】的更多相关文章

PAT (Advanced Level) Practice 1023 Have Fun with Numbers (20 分) 凌宸1642 题目描述: 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 happens to be…
1023 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 happens to be another 9-digit number consisting exactl…
1023 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 happens to be another 9-digit number consisting exactl…
题意: 输入一个不超过20位的正整数,问乘2以后是否和之前的数组排列相同(数字种类和出现的个数不变),输出Yes或No,并输出乘2后的数字. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; string s; ]; int main(){ cin>>s; int len=s.size(); ;i>=;--i) ++vis[s[i]-'…
题意: 输入一个正整数N(<100),接着输入N组数据每组包括一行字符串,将其翻译为另一个星球的数字. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ][]={","tam","hel","maa","huh","tou","kes…
1069 The Black Hole of Numbers (20 分)   For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by taking the seco…
1023 Have Fun with Numbers (20)(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 happens to be another 9-digit number consisting exac…
PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642 题目描述: 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 specified order.…
PAT甲级:1152 Google Recruitment (20分) 题干 In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL consisting of the first 10-digit prime found…
1069 The Black Hole of Numbers (20分) 1. 题目 2. 思路 把输入的数字作为字符串,调用排序算法,求最大最小 3. 注意点 输入的数字的范围是(0, 104), 如果作为字符串处理时要注意前面补0 4. 代码 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; bool cmp(char a, char b){ return a>…
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: 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 distinguish 1 (o…
PAT乙级:1072开学寄语(20分) 题干 下图是上海某校的新学期开学寄语:天将降大任于斯人也,必先删其微博,卸其 QQ,封其电脑,夺其手机,收其 ipad,断其 wifi,使其百无聊赖,然后,净面.理发.整衣,然后思过.读书.锻炼.明智.开悟.精进.而后必成大器也! 本题要求你写个程序帮助这所学校的老师检查所有学生的物品,以助其成大器. 输入格式: 输入第一行给出两个正整数 N(≤ 1000)和 M(≤ 6),分别是学生人数和需要被查缴的物品种类数.第二行给出 M 个需要被查缴的物品编号,其…
PAT乙级:1057 数零壹 (20分) 题干 给定一串长度不超过 105 的字符串,本题要求你将其中所有英文字母的序号(字母 a-z 对应序号 1-26,不分大小写)相加,得到整数 N,然后再分析一下 N 的二进制表示中有多少 0.多少 1.例如给定字符串 PAT (Basic),其字母序号之和为:16+1+20+2+1+19+9+3=71,而 71 的二进制是 1000111,即有 3 个 0.4 个 1. 输入格式: 输入在一行中给出长度不超过 105.以回车结束的字符串. 输出格式: 在…
PAT乙级:1082 射击比赛 (20分) 题干 本题目给出的射击比赛的规则非常简单,谁打的弹洞距离靶心最近,谁就是冠军:谁差得最远,谁就是菜鸟.本题给出一系列弹洞的平面坐标(x,y),请你编写程序找出冠军和菜鸟.我们假设靶心在原点(0,0). 输入格式: 输入在第一行中给出一个正整数 N(≤ 10 000).随后 N 行,每行按下列格式给出: ID x y 其中 ID 是运动员的编号(由 4 位数字组成):x 和 y 是其打出的弹洞的平面坐标(x,y),均为整数,且 0 ≤ |x|, |y|…
PAT乙级:1084 外观数列 (20分) 题干 外观数列是指具有以下特点的整数序列: d, d1, d111, d113, d11231, d112213111, ... 它从不等于 1 的数字 d 开始,序列的第 n+1 项是对第 n 项的描述.比如第 2 项表示第 1 项有 1 个 d,所以就是 d1:第 2 项是 1 个 d(对应 d1)和 1 个 1(对应 11),所以第 3 项就是 d111.又比如第 4 项是 d113,其描述就是 1 个 d,2 个 1,1 个 3,所以下一项就是…
PAT乙级:1063 计算谱半径 (20分) 题干 在数学中,矩阵的"谱半径"是指其特征值的模集合的上确界.换言之,对于给定的 n 个复数空间的特征值 { a1+b1i,⋯,a**n+bni },它们的模为实部与虚部的平方和的开方,而"谱半径"就是最大模. 现在给定一些复数空间的特征值,请你计算并输出这些特征值的谱半径. 输入格式: 输入第一行给出正整数 N(≤ 10 000)是输入的特征值的个数.随后 N 行,每行给出 1 个特征值的实部和虚部,其间以空格分隔.注…
1023 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 happens to be another 9-digit number consisting exactly t…
1023 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 happens to be another 9-digit number consisting exactl…
1041 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​​]. The first one who bets on a unique number wins. For…
1144 The Missing Number(20 分) Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. For each case, the first line gives a positive integer…
1054 The Dominant Color(20 分) Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A str…
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 are for Red, the middle 2 digits for Green, and the l…
1136 A Delayed Palindrome(20 分) Consider a positive integer N written in standard notation with k+1 digits a​i​​ as a​k​​⋯a​1​​a​0​​ with 0≤a​i​​<10 for all i and a​k​​>0. Then N is palindromic if and only if a​i​​=a​k−i​​ for all i. Zero is written…
1144 The Missing Number (20 分)   Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains one test case. For each case, the first line gives a positive integ…
1054 The Dominant Color (20 分)   Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A …
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 are for Red, the middle 2 digits for Green, and th…
1108 Finding Average (20 分) The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be legal. A legal input is a real number in [−1000,1000…
1044 火星数字 (20 分) 火星人是以 13 进制计数的: 地球人的 0 被火星人称为 tret. 地球人数字 1 到 12 的火星文分别为:jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec. 火星人将进位以后的 12 个高位数字分别称为:tam, hel, maa, huh, tou, kes, hei, elo, syy, lok, mer, jou. 例如地球人的数字 29 翻译成火星文就是 hel mar:而火星文…
1068 万绿丛中一点红(20 分) 对于计算机而言,颜色不过是像素点对应的一个 24 位的数值.现给定一幅分辨率为 M×N 的画,要求你找出万绿丛中的一点红,即有独一无二颜色的那个像素点,并且该点的颜色与其周围 8 个相邻像素的颜色差充分大. 输入格式: 输入第一行给出三个正整数,分别是 M 和 N(≤ 1000),即图像的分辨率:以及 TOL,是所求像素点与相邻点的颜色差阈值,色差超过 TOL 的点才被考虑.随后 N 行,每行给出 M 个像素的颜色值,范围在 [0,2​24​​) 内.所有同…
1067 试密码(20 分) 当你试图登录某个系统却忘了密码时,系统一般只会允许你尝试有限多次,当超出允许次数时,账号就会被锁死.本题就请你实现这个小功能. 输入格式: 输入在第一行给出一个密码(长度不超过 20 的.不包含空格.Tab.回车的非空字符串)和一个正整数 N(≤ 10),分别是正确的密码和系统允许尝试的次数.随后每行给出一个以回车结束的非空字符串,是用户尝试输入的密码.输入保证至少有一次尝试.当读到一行只有单个 # 字符时,输入结束,并且这一行不是用户的输入. 输出格式: 对用户的…