# ICode9

• ## 四大具有含金量高的算法证书考试2022-09-07 01:31:48

一、PAT 计算机程序设计能力测试 官网：PAT 计算机程序设计能力测试 PAT为浙江大学出的一款程序设计的测试网站，分为乙级、甲级、顶级三种，都是通过一道题目，写出此题目描述的程序，主要是考察基本语法和算法与数据结构的能力。 举办时间：每年举办3次，一般为每年3月、9月和12月。 可选语言：c

• ## PAT_A 1037 Magic Coupon2022-09-04 23:31:52

PAT_A 1037 Magic Coupon 分析 尽量增大总回报值即可得到结果。 PAT_A 1037 Magic Coupon 题目的描述 The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get

• ## C++正则匹配字符串2022-09-01 19:04:58

以下实例使用C++正则从一串混乱的字符串中匹配带小数点的数字 点击查看代码 #include <iostream> #include <regex> using namespace std; int main() { smatch results; string str = "adbhjasdhaj1231.123QWEE QWEQWWQEDXQ 12346.4156"; string pat("\\d+\\.\

• ## PAT Advanced 1029 Median（25）2022-08-28 23:03:24

题目描述： Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 } is 15. The median of two sequences is defined to be

• ## PAT Advanced 1024 Palindromic Number（25）2022-08-22 22:05:12

题目描述： 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 single digit numbers are palindromic numbers. Non-palindromic numbers can be paired with pali

• ## PAT 计数2022-08-22 21:00:09

https://www.acwing.com/problem/content/1585/ 状态机的解法 #include <iostream> #include <cstring> using namespace std; const int N = 100010, MOD = 1e9 + 7; int n; char s[N], p[] = " PAT"; int f[N][4]; int main() { cin >> s +

• ## PAT Advanced 1036 Boys vs Girls（25）2022-08-21 01:33:42

题目描述： 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 input file contains one test case. Each case contains a positive integer N,

• ## PAT Advanced 1020 Tree Traversals（25）2022-08-19 00:02:54

题目描述： Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corresponding binary tree. Input Specification: Each

• ## 1057 数零壹——20分2022-08-14 09:31:02

给定一串长度不超过10^5的字符串，本题要求你将其中所有英文字母的序号（字母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。 输入

• ## 字符串专题-KMP+扩展KMP2022-08-14 00:03:41

KMP算法 例题1：E. Martian Strings【前缀函数的运用】 这一题笨笨地写了个SA+二分，慢死了（常数大）。虽然这一题是多串匹配，但是\(m=100\)，S串长度为\(1e5\)，所以是可以暴力check每一个pattern的。。但是因为这一题要把一个串分成两个不相交的区间，所以考虑顺序、逆序做一次KMP，特判长度

• ## PAT Advanced 1009 Product of Polynomials（25）2022-08-12 16:33:01

题目描述： This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: K N1​ aN1​ ​ N2​ aN2​ ​ ... NK​ aNK​ ​ where K is the number of nonzero terms in the polynomial, Ni​ and aNi​ ​(i=1,2,⋯,K) are the expo

• ## 1103. Integer Factorization (30)-PAT甲级真题（dfs深度优先）2022-08-08 22:04:42

The K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K-P factorization of N for any positive integers N, K and P. Input Specification: Each input f

• ## pat甲级考试+pat1051+10562022-08-07 02:03:29

同上一篇博客； 贪心题目我已经刷了将近30道了，由于那几天考驾照就没写，以后有空的时候补过来吧，都在codeblock里 pat的题也刷了点，acwing 的题也刷了点，基本都攒下了。以后也会慢慢补过来的 这几天都在备战四级，上午司机下午算法，有点忙不过来就一直没写博客，今天打完比赛就想趁热写一下吧，

• ## PAT (Advanced Level) Practice 1006 Sign In and Sign Out 分数 25 Python 解法2022-08-01 21:02:39

题目 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 are supposed to find the ones who have un

• ## PAT (Advanced Level) Practice 1009 Product of Polynomials 分数 252022-08-01 21:01:29

题目 This time, you are supposed to find A×B where A and B are two polynomials.Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial:\$ K N_1 a_N_1 N_2 a_N_2 ... N_K a_

• ## PAT (Advanced Level) Practice 1008 Elevator 分数 20 Python 解法2022-08-01 14:33:58

题目 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. It costs 6 seconds to move the elevator up one floor, and 4 second

• ## PAT (Advanced Level) Practice 1003 Emergency Python 解法2022-07-30 09:02:04

题目： As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length of each road between any pair of cities are m

• ## 每周进度报告（第四周）2022-07-22 18:11:59

1.本周做了什么     （1）自学java：疯狂java讲义（6-7章）。       (2)算法：牛客多校训练营比赛1。       (3)小学期：PAT基础水平练习每两道。 2.下周准备做什么     （1）疯狂java讲义(8-10章)。     （2）牛客多校训练营比赛2、3。     （3）PAT基础水平每天两道。 3.遇到的问题，如何解决

• ## 2022.07.22-初读《大道至简——软件工程实践者的思想》2022-07-22 17:01:08

本周一(2022.07.18)，写了PAT (Basic Level) Practice （中文）1016、1017。本周二(2022.07.19)，写了PAT (Basic Level) Practice （中文）1018，阅读《大道至简——软件工程实践者的思想》。本周三(2022.07.20)，写了PAT (Basic Level) Practice （中文）1019，阅读《大道至简——软件工程实践者的思想

• ## PAT乙级 1002 写出这个数 C++2022-07-15 15:38:20

//读入一个正整数 n，计算其各位数字之和，用汉语拼音写出和的每一位数字。 #include <iostream>#include <stdio.h>#include <string.h> int main(void){ char num[102] = { 0 }; char pinyin[3] = { 0 }; int i = 0; int sum = 0; int cnt = 0; std::cin >> num;

• ## 1085 PAT单位排行2022-07-13 14:31:31

注意点 bool cmp_diy(const pair3& a,const pair3& b){//const xxx & x 作用是引用某个变量，只读它的内容，但不能修改这个引用的变量 代码 #include <iostream> #include <cstdio> #include <string> #include <map> #include <set> #include <utility> #in

• ## 1040 有几个PAT2022-07-08 19:32:26

关键 PAT的个数就是A左边P的个数乘以右边T的个数 时间复杂度必须为o(n) 思路 从头开始向后遍历字符串。 如果是’P'，A左边的p的count++； 如果是‘A'，cnt+=A左边的p的count*（t的count-A左边的t的count）； 如果是’T‘，A左边的t的count++ 代码 #include <iostream>#include <cstdio>#i

• ## PAT_B 1023 组个最小数2022-07-01 01:31:47

PAT_B 1023 组个最小数 分析 逐个数字统计，首先找到第一个非0数，接着按顺序输出 PAT_B 1023 组个最小数 题目的描述 给定数字 0-9 各若干个。你可以以任意顺序排列这些数字，但必须全部使用。目标是使得最后得到的数尽可能小（注意 0 不能做首位）。例如：给定两个 0，两个 1，三个 5，一个 8，我们

• ## PAT_A 1041 Be Unique2022-06-29 00:01:11

PAT_A 1041 Be Unique 分析 建立对应的关系按要求统计分析即可满足题目的要求。 PAT_A 1041 Be Unique 题目的描述 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

• ## PAT_B 1047 编程团体赛2022-06-28 01:00:07

PAT_B 1047 编程团体赛 分析 逐个字符统计分析即可 PAT_B 1047 编程团体赛 题目的描述 编程团体赛的规则为：每个参赛队由若干队员组成；所有队员独立比赛；参赛队的成绩为所有队员的成绩和；成绩最高的队获胜。 现给定所有队员的比赛成绩，请你编写程序找出冠军队。 输入格式： 输入第一行给