PAT甲级:1136 A Delayed Palindrome (20分) 题干 Look-and-say sequence is a sequence of integers as the following: D, D1, D111, D113, D11231, D112213111, ... where D is in [0, 9] except 1. The (n+1)st number is a kind of description of the nth number. For ex…
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…
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 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…
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 in consecutive digits of the natural co…
题意: 输入洗牌次数K(<=20),输入54张牌每次洗入的位置(不是交换的位置),输出洗好的牌. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; multiset<int>st; ]; ],b[]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);…
题意: 输入一个正整数K(1<K<=100),接着输入一行字符串由小写字母,数字和下划线组成.如果一个字符它每次出现必定连续出现K个,它可能是坏键,找到坏键按照它们出现的顺序输出(相同坏键仅输出一次,数据保证必定存在坏键),接着输出将坏键修好后原本的字符串(K个连续坏键只输出一次). trick: 测试点1答案错误原因:出现次数为K的倍数而不是大于等于K 测试点2,3错误原因:输出原字符串时没有检验最后一段连续相同字符是否为坏键(循环当中没有检验这一段) AAAAAccepted code:…
题意: 输入一个正整数N(<=100),接着输入一行N组字符串,表示一个数字,如果这个数字大于1000或者小于1000或者小数点后超过两位或者压根不是数字均为非法,计算合法数字的平均数. trick: 测试点2答案错误原因:题面指出如果只有一个合法数字,输出numbers的时候不加s,即为number. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std;…