随笔分类 - PAT
摘要:``` //当前先序序列区间为[preL,preR],中序序列区间为[inL,inR],返回根结点地址 node* create(int preL, int preR, int inL, int inR) { if(preL > preR) { return NULL; //先序序列长度小于等于0时,直接返回 } node* root = new node; //新建一个新的结点,用来存放当前二叉
阅读全文
摘要:题目描述 输出格式 输出格式 输入样例 输出样例 《算法笔记》中AC答案
阅读全文
摘要:《算法笔记》学习笔记 map 常见用法详解 map翻译为映射,也是常用的STL容器 map可以将任何基本类型(包括STL容器)映射到任何基本类型(包括STL容器) 1. map 的定义 2. map 容器内元素访问 (1) 通过下标访问 (2) 通过迭代器访问 3. map常用函数实例解析 (1)
阅读全文
摘要:题目描述 To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C C Programming Language, M Ma
阅读全文
摘要:题目描述 A long distance telephone company charges its customers by the following rules: Making a long distance call costs a certain amount per minute, de
阅读全文
摘要:题目描述 宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。” 现给出一批考生的德才分数,请根据司马光的理论给出录取排名。 输入格式 输入第一行给出 3 个正整
阅读全文
摘要:题目描述 The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is fo
阅读全文
摘要:题目描述 给定数字 0 9 各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意 0 不能做首位)。例如:给定两个 0,两个 1,三个 5,一个 8,我们得到的最小的数就是 10015558。 现给定数字,请编写程序输出能够组成的最小的数。 输入格式 输入在一
阅读全文
摘要:题目描述 月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。 注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有 3 种月饼,其库存量分别为 18、15、10 万吨,总售
阅读全文
摘要:题目描述 输入格式 输出格式 输入样例 输出样例 全部AC include include include include //p115 using namespace std; const int maxn = 30010; struct Student { char registration_n
阅读全文
摘要:AC代码 注意创造函数条件中使用引用 输出语句注意单复数
阅读全文
摘要:AC代码 include include include include using namespace std; const int max_n = 110; int main() { ifdef ONLINE_JUDGE else freopen("1.txt", "r", stdin); en
阅读全文
摘要:书中AC代码 include include include include const int max_n = 10100; using namespace std; void Print(bool a) { if(!a) printf(" "); } int main() { ifdef ONL
阅读全文
摘要:书中AC代码 include include include using namespace std; int main() { ifdef ONLINE_JUDGE else freopen("1.txt", "r", stdin); //char DD; //日期 endif // ONLINE
阅读全文
摘要:AC代码 include include using namespace std; const int max_n = 110; //权重 int W[17] = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; //验证码 char M[
阅读全文
摘要:AC代码 include include include using namespace std; const int max_n = 1010; char ans[max_n]; int count[10][2] = {0}; int main() { ifdef ONLINE_JUDGE els
阅读全文