08 2020 档案
摘要:这道题有点抽象, 先举几个栗子:chestnut:, 找一下规律. (太长不看) 记从到中出现的次数为, 个位上的数为, 十位上的数为, 百位上的数为, 以此类推. 当为1位数时 设, 则. 此时总结可得:
阅读全文
摘要:浮点错误:边加边化简(注意溢出) 特判:和为 补充:带分数 非零自然数与真分数相加(负整数时与真分数相减)所成的分数 👉 code
阅读全文
摘要:记原数组为 ,部分排序数组为 Insertion sort 的前面部分有序,后面的无序部分与 相同 Merge sort 对 进行模拟归并排序,将每一个状态与 比较。若 ,则再进行一次归并排序后退出 Heap sor
阅读全文
摘要:交集 std::set_intersection Constructs a sorted range beginning in the location pointed by result with the set intersection of the two sorted ranges [fir
阅读全文
摘要:注意到题目要求输出链表的节点个数,说明输入的节点中存在无效数据 特判:空链表 👉 code
阅读全文
摘要:**注意到,,**那么对于数据集可以进行如下处理: 按题目要求对所有数据排序。 建立标记数组c[AGE],在中记录年龄为的人数,其中const int AGE = 205。再建立新数组s[N],记录有效数据。 遍历已有序的数据
阅读全文
摘要:这道题主要是解决超时问题 使用unordered_map代替map 参考: std::unordered_map map与unordered_map map和unordered_map的差别和使用 在PAT里使用map还是unordered_map? 使用unordered_map<string,
阅读全文
摘要:题目的要求即为:对任意两个数字,确定它们的排序,使得两个数字串起来后得到的新数字最小 struct cmp { bool operator() (const int a, const int b) { char str[2][2*M]; strcpy(str[0], num[a]); strcat(
阅读全文