├── .gitattributes ├── .nojekyll ├── 00.Pre ├── Part01.Vim和VScode使用手册.md ├── Part02.刷题目录.md └── Part03.STL刷题目录.md ├── 01.PAT ├── 01.乙级C++11版本.md ├── 02.甲级C++11版本.md ├── 03.顶级C++11版本.md └── PAT目录结构.md ├── 02.CCF_CSP ├── 2013年 │ ├── 2013年12月.md │ └── 目录.md ├── 2014年 │ ├── 2014年03月.md │ ├── 2014年09月.md │ ├── 2014年12月.md │ └── 目录.md ├── 2015年 │ ├── 2015年03月.md │ ├── 2015年09月.md │ ├── 2015年12月.md │ └── 目录.md ├── 2016年 │ ├── 2016年04月.md │ ├── 2016年09月.md │ ├── 2016年12月.md │ └── 目录.md ├── 2017年 │ ├── 2017年03月.md │ ├── 2017年09月.md │ ├── 2017年12月.md │ └── 目录.md ├── 2018年 │ ├── 2018年03月.md │ ├── 2018年09月.md │ ├── 2018年12月.md │ └── 目录.md ├── 2019年 │ ├── 2019年03月.md │ ├── 2019年09月.md │ ├── 2019年12月.md │ └── 目录.md ├── 2020年 │ ├── 2020年06月.md │ ├── 2020年09月.md │ ├── 2020年12月CSP考场环境.md │ └── 目录.md ├── 2021年 │ ├── 2021年04月.md │ ├── 2021年09月.md │ ├── 2021年12月.md │ └── 目录.md ├── CSP应试策略.md └── CSP目录结构.md ├── 03.NowCoder ├── 01.腾讯.md ├── 05.华为.md ├── 06.美团.md ├── 09.深信服.md ├── 91.67.png ├── README.md └── S深信服 │ ├── 02.深信服B卷(完成AK) │ └── 3.最优二叉树别人题解.pdf │ ├── 03.深信服D卷(还有一题没有AC无100) │ ├── 2.统计累加算式(dpAC) │ │ ├── 01.第一次(0.4) │ │ │ ├── test_two.cpp │ │ │ ├── 我的第一次推测错误的原因.docx │ │ │ └── 第一次-我猜测去找规律-分是二进制的和不是的(结果只通过了0.4).png │ │ ├── 02.第2次(方法1-找规律)AC │ │ │ ├── test_digui.cpp │ │ │ └── 找这个规律-有点像具体数学那本书里面前面讲的一样吧.txt │ │ ├── 03.(方法2-DP)AC │ │ │ └── test_two.cpp │ │ └── 2.统计累加算式.pdf │ └── 3.攻击识别(目前牛客没人AC-但有个过了3分之1点) │ │ ├── 1.尝试1()只过了样例 │ │ ├── 1.jpg │ │ ├── 2.样例过了-但是测试数据真心离谱.txt │ │ └── test_three.cpp │ │ └── 3.攻击识别.pdf │ ├── 06.H卷(以前做了一点)(无100的——) │ ├── 1.png │ ├── 2访问权限(不会做) │ │ ├── 2访问权限.pdf │ │ └── 别人用前缀树——AC的 │ │ │ ├── tt.cpp │ │ │ └── 前缀树.png │ ├── 3.手机号查询(超时70) │ │ ├── 3.手机号查询.pdf │ │ ├── 别人AC的 │ │ │ └── Untitled1.cpp │ │ ├── 方法1(暴力)(只通过了0.7—超过时间了) │ │ │ ├── test.cpp │ │ │ └── 超时.png │ │ └── 方法2(KMP算法) │ │ │ ├── 改变了next数组名字为Next虽然解决了-但是还是显示时间复杂度高 │ │ │ ├── QQ截图20200512172222.png │ │ │ └── kmp.cpp │ │ │ └── 第一次提交的奇怪的错误 │ │ │ ├── KMP.cpp │ │ │ ├── QQ截图20200512171951.png │ │ │ └── 原因.png │ └── 4.数字序列 │ │ ├── 4.数字序列.pdf │ │ ├── 别人说这题数据有问题 │ │ └── Untitled1.cpp │ │ └── 第一次尝试(样例AC)但是超出内存了 │ │ ├── test1.cpp │ │ └── (发现-似乎时间复杂度也高了)后面看完别人说数据可能有问题.txt │ └── 2020年暑假-深信服实习-星耀计划第1次笔试.md ├── 04.北大百练 ├── 01.简单计算和模拟.md ├── 02.枚举.md ├── 03.递归.md ├── 04.二分查找.md ├── 05.贪心算法.md ├── 06.动态规划.md ├── 07.深度优先搜索DFS.md ├── 08.广度优先搜索BFS.md └── 百练.md ├── LICENSE ├── README.md ├── _coverpage.md ├── _sidebar.md ├── autoDeploy.sh └── index.html /.gitattributes: -------------------------------------------------------------------------------- 1 | *.html linguist-language=c++ 2 | *.css linguist-language=c++ 3 | *.js linguist-language=c++ 4 | -------------------------------------------------------------------------------- /.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/.nojekyll -------------------------------------------------------------------------------- /00.Pre/Part01.Vim和VScode使用手册.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > 笔者常用三大『文本编辑器』如下 4 | 5 | 6 | 7 |
一、Vim使用
8 | 9 | > vim这个文本编辑器,多练习一下能达到批处理的效果 10 | > 11 | > 虽然没有进行设置前,语法高亮可能很丑 12 | > 13 | > 笔者习惯: 14 | > 15 | > - Windows平台下,借助Git带的Vim也写过,有个别字符显示不好,常用**『Sublime』** 16 | > 17 | > - 在linux平台下,笔者一般使用Vim 18 | 19 | 20 | 21 | **Vim三种模式** 22 | 23 | Vim编辑器中设置了三种模式一命令模式、末行模式和编辑模式 24 | **每种模式分别又支持多种不同的命令快捷键** 25 | 26 | 我们先弄清这三种模式的操作区别以及模式之间的切换方法 27 | 28 | >- 命令模式:控制**光标**移动,可对文本进行**复制**、**粘贴**、**删除**和**查找**等工作。 29 | >- 输人模式:正常的文本录入。 30 | >- 末行模式:保存或退出文档,以及设置**编辑环境**。 31 | 32 | 33 | 34 | 说明: 35 | `vim 文件名` 则进入了vim的命令模式 36 | 1)在每次运行Vim编辑器时,**默认进入**命令模式 37 | 2)此外,**『每次在编写完文档后需要先返回命令模式,然后再进人末行模式』(优势)**,执行文档.的保存或退出操作。 38 | **在Vim中,无法直接从输人模式切换到末行模式。** 39 | 40 | 命令模式进入输入模式: 41 | >- **i取自insert**插入, 42 | >- `i` 光标处**前一个字符**编辑 43 | >- `I` 大写的 i,光标所处**行首**编辑 44 | 45 | >- **a取append**追加,(我记得在Python中有用过这个函数,然后**C++11中也有**) 46 | >- `a` 光标处**后一个字符**编辑 47 | >- `A` 光标所处**行尾**编辑 48 | 49 | >- 暂时没想到 50 | >- `o` 光标处**向下新建一行编辑『熟悉』** 51 | >- `O` 大写的 o,光标处**向上**新建一行编辑 52 | 53 | 54 | 55 | #### (1)命令模式 56 | 57 | > Tips:输入的时候,留意**右下角**,其实有你的按键输入 58 | 59 | 命令模式:控制光标移动,可对文本进行复制、粘贴、删除和查找等工作。 60 | 61 | >- 剪切类(可以用作删除)(但是**d却是delete删除,首字母**) 62 | >>- `dd`剪切(删除)**光标所在整行** 63 | >>- `5dd`删除(剪切)从光标处开始的5行 64 | 65 | >- 复制类(暂时用**copy的末尾y记忆**) 66 | >>- `yy`复制**光标所在整行** 67 | >>- `5yy`复制从光标处开始的5行 68 | 69 | >- **『常用』**粘贴(**p是paste**粘贴,首字符) 70 | > 71 | >>- `p`将之前剪切(dd)或复制(yy)过的数据粘贴到光标后面 72 | 73 | >- **『常用』**撤销(**u是unsay**收回,撤回,首字母) 74 | > 75 | >>- `u`撤销上一步的操作,**类似Windows下快捷键『Ctrl+Z』** 76 | 77 | >- 单个字符修改 78 | >>- `X`删除光标所处的字符:X(和Windows下Ctrl+X有点类似了,但是只是删除) 79 | >>- 按`R`后输入新的字符替换光标所处的字符 80 | 81 | 82 | 83 | >- 字符串**匹配**后续 84 | >>- `n`显示搜索命令定位到的下一个字符串 85 | >>- `N`显示搜索命令定位到的上一个字符串 86 | 87 | 88 | 89 |
90 | 91 | 92 | #### (2)末行模式 93 | 末行模式:保存或退出文档,以及设置编辑环境。 94 | 95 | 末行模式的命令都写在你用`:`进去末行模式后面 96 | > 总的来说格式: 97 | > `:命令`执行该命令 98 | 99 | 100 | **下面的都省略了`:`** 101 | `整数`跳转到这个整数的那一行 102 | `w` 保存 103 | `q` 退出(quit) 104 | `q!`强制退出(放弃对文档的修改内容) 105 | 106 | `wq!`强制保存退出 107 | 108 | >- **『常用』**看代码常用 109 | >>- `set nu`显示行号,nu——num 110 | >>- `set nonu`显示行号, 111 | 112 | 113 | >- **『常用』**查找和替换 114 | >>- 查找 115 | >>>- `/字符串` 在文本中**从上至下**搜索该字符串 116 | >>>- `?字符串` 在文本中**从下至上**搜索该字符串 117 | >>- 替换 118 | >>>- `:s/one/two`将**当前光标所在行**的第一个 one替换成two 119 | >>>- `:s/one/two/g`将当**前光标所在行**的**所有**one替换成two 120 | >>>- `:%s/one/two/g 8s/one/two/g`将**全文**中的**所有**one替换成two 121 | 122 | #### (3)输入模式 123 | 124 | 输人模式:正常的文本录入。 125 | 126 | 127 | 128 | 129 | 130 |
二、VScode使用
131 | 132 | #### (1)C++98编译 133 | 134 | - 编译快捷键 135 | 136 | 安装完VScode中的C++编译插件后,『Ctrl+Alt+N』 137 | 138 | 139 | 140 | #### (2)C++11编译 141 | 142 | 用c++11来编译(注意,C++的c是小写!!!) 143 | 144 | ```cpp 145 | g++ -std=c++11 .\solve.cpp 146 | ``` 147 | 148 | > 技巧: 149 | > 150 | > 1、Windows平台的用户如果下载了Git,那么他的bash中就能执行`.sh`shell文件,你可以写一个`cpl.sh`的批处理脚本 151 | > 152 | > ```bash 153 | > g++ -std=c++11 ./solve.cpp -o solve.out 154 | > echo _________________编译通过___________________ 155 | > echo ____________下面开始执行该程序_______________ 156 | > ./solve.out 157 | > pause 158 | > ``` 159 | > 160 | > 2、如果是Linux下用户,可以仿照上面技巧 161 | 162 | 163 | 164 |
三、Sublime使用
165 | 166 | > 个人在Windows平台写代码常用的『文本编辑器』 167 | > 168 | > **优点:** 169 | > 170 | > 1、有代码提示 171 | > 172 | > 2、语法高亮界面很像『MAC』的,很有艺术感 173 | > 174 | > 3、简洁 175 | > 176 | > **使用:** 177 | > 178 | > 方法一:设置编译快捷键 179 | > 180 | > 方法二:自己本机就有Git,直接写`.sh`脚本编译,或者编写`.bat`批处理脚本编译 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 |
批量生成Markdown文件
191 | 192 | #### cmd用for循创建数据 193 | 194 | ```txt 195 | for /l %i in (1,1,999) echo %i >>test.txt 196 | ``` 197 | 198 | 199 | #### 批量生成Markdown文件 200 | 201 | ```batch 202 | @echo off 203 | echo 正在创建B0.txt~test9.txt共十个文本文件...... 204 | 205 | for /l %%i in (1001, 1, 1095) do ( 206 | echo 我是PAT的B%%i.md题 >> B%%i.md 207 | ) 208 | echo 文件创建完毕 209 | ``` 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | #### 刷题建议 218 | 219 | - 先学知识点,再刷对应的题目:『专题训练』 220 | - 对一个章节进行集中训练,不要为了做题而做题! 221 | - 训练前先『独立思考』 222 | - (1)不会时,看书上思路,然后『自己编码实现』 223 | - 如果还是不会,那么就抄写代码,并且将题目放进自己的刷题复习队列中,一个星期后重新刷 224 | - (2)如果多次提交,某些样例过不了 225 | - 看边界数据『这是你的思考不严谨』,或者看题目是不是题意表达不清楚『出题者的过错』 226 | 227 | 228 | 229 | 英语题目: 230 | 231 | - 题意、样例解释、思路、注意点、参考代码 232 | 233 | 算法笔记,有150多题解,不包含全部 -------------------------------------------------------------------------------- /00.Pre/Part02.刷题目录.md: -------------------------------------------------------------------------------- 1 | # 『分题型』传送门 2 | 3 | 4 | 5 | - 基于『算法笔记』和『算法基础与在线实践』 6 | - 辅以笔者刷过的的**『牛客』**、**『CSP』**、**『北大百练』**进行分类训练 7 | 8 | 9 | > | 标识符 | 意义 | 10 | > | ------ | -------- | 11 | > | B | PAT乙级 | 12 | > | A | PAT甲级 | 13 | > | S | PAT顶级 | 14 | > | 百练 | 北大百练 | 15 | > | 牛客 | 牛客网 | 16 | > 17 | > **说明**: 18 | > 19 | > - [x] 表示已更新 20 | 21 | ## 01.入门模拟(模拟) 22 | 23 | ### 1简单模拟 24 | 25 | - [x] | B1001 | [害死人不偿命的(3n+1)猜想](https://pintia.cn/problem-sets/994805260223102976/problems/994805325918486528) 26 | - [x] | B1011 | [A+B 和 C](https://pintia.cn/problem-sets/994805260223102976/problems/994805312417021952) 27 | - [x] | B1016 | [部分A+B](https://pintia.cn/problem-sets/994805260223102976/problems/994805306310115328) 28 | - [x] | B1026 | [程序运行时间](https://pintia.cn/problem-sets/994805260223102976/problems/994805295203598336) 29 | - [x] | B1046 | [划拳](https://pintia.cn/problem-sets/994805260223102976/problems/994805277847568384) 30 | - [x] | B1008 | [数组元素循环右移问题](https://pintia.cn/problem-sets/994805260223102976/problems/994805316250615808) 31 | - [x] | B1012 | [数字分类](https://pintia.cn/problem-sets/994805260223102976/problems/994805311146147840) 32 | - [x] | B1018 | [锤子剪刀布](https://pintia.cn/problem-sets/994805260223102976/problems/994805304020025344) 33 | - [x] | A1042 | [Shuffling Machine](https://pintia.cn/problem-sets/994805342720868352/problems/994805442671132672) 34 | - [x] | A1046 | [Shortest Distance](https://pintia.cn/problem-sets/994805342720868352/problems/994805435700199424) 35 | - [x] | A1065 | [A+B and C (64bit)](https://pintia.cn/problem-sets/994805342720868352/problems/994805406352654336) | (很有用的技巧,判断64位的溢出) 36 | - [x] | B1010 | [一元多项式求导](https://pintia.cn/problem-sets/994805260223102976/problems/994805313708867584) 37 | - [x] | A1002 | [A+B for Polynomials](https://pintia.cn/problem-sets/994805342720868352/problems/994805526272000000) | 最常见编程技巧和注意事项:浮点数之间的比较 38 | - [x] | A1009 | [Product of Polynomials](https://pintia.cn/problem-sets/994805342720868352/problems/994805509540921344) 39 | - [x] 百练3237:[鸡兔同笼](http://bailian.openjudge.cn/practice/3237/) 40 | - [x] 百练2808:[校门外的树](http://bailian.openjudge.cn/practice/2808/) 41 | - [x] 百练1017:[装箱问题](http://bailian.openjudge.cn/practice/1017)『需思路清晰」😲 42 | - [x] 百练2746:[约瑟夫问题](http://bailian.openjudge.cn/practice/2746/)『低配版』 43 | - [ ] 百练2745:[显示器](http://bailian.openjudge.cn/practice/2745) 44 | - [x] 百练1833:[排列](http://bailian.openjudge.cn/practice/1833) 45 | - [x] 百练2701:[与7无关的数](http://bailian.openjudge.cn/practice/2701) 46 | - [x] 百练2712:[细菌繁殖](http://bailian.openjudge.cn/practice/2712) 47 | - [x] 百练2733:[判断闰年](http://bailian.openjudge.cn/practice/2733) 48 | - [x] 百练2707:[求一元二次方程的根](http://bailian.openjudge.cn/practice/2707)『精度很坑』 49 | - [x] 百练2711:[合唱队形](http://bailian.openjudge.cn/practice/2711)『动态规划题-牛客[题解](https://www.nowcoder.com/questionTerminal/cf209ca9ac994015b8caf5bf2cae5c98)』 50 | 51 | 52 | 53 | ### 2枚举 54 | 55 | - [x] 百练2692:[假币问题](http://bailian.openjudge.cn/practice/2692) 56 | - [x] 百练4148:[生理周期](http://bailian.openjudge.cn/practice/4148) 57 | - [x] 百练2810:[完美立方](http://bailian.openjudge.cn/practice/2810) 58 | - [ ] 百练2811:[熄灯问题](http://bailian.openjudge.cn/practice/2811) 59 | - [ ] 百练2812:[恼人(讨厌)的青蛙](http://bailian.openjudge.cn/practice/2812) 60 | - [x] 百练4146:[数字方格](http://bailian.openjudge.cn/practice/4146)(数字三元组) 61 | - [x] 百练4138:[质数的和与积](http://bailian.openjudge.cn/practice/4138) 62 | - [x] 百练4139:[不定方程求解](http://bailian.openjudge.cn/practice/4139) 63 | - [x] 百练4141:[砝码称重](http://bailian.openjudge.cn/practice/4141) 64 | - [ ] 百练4133:[垃圾炸弹](http://bailian.openjudge.cn/practice/4133) 65 | 66 | 67 | 68 | 69 | 70 | ### 3查找元素 71 | 72 | - [x] | B1041 | [考试座位号](https://pintia.cn/problem-sets/994805260223102976/problems/994805281567916032) 73 | - [x] | B1004 | [ 成绩排名](https://pintia.cn/problem-sets/994805260223102976/problems/994805321640296448) 74 | - [x] | B1028 | [人口普查](https://pintia.cn/problem-sets/994805260223102976/problems/994805293282607104) 75 | - [x] | B1032 | [ 挖掘机技术哪家强](https://pintia.cn/problem-sets/994805260223102976/problems/994805289432236032) 76 | - [x] | A1011 | [World Cup Betting](https://pintia.cn/problem-sets/994805342720868352/problems/994805504927186944) 77 | - [x] | A1006 | [Sign In and Sign Out](https://pintia.cn/problem-sets/994805342720868352/problems/994805516654460928) 78 | - [x] | A1036 | [ Boys vs Girls](https://pintia.cn/problem-sets/994805342720868352/problems/994805453203030016) 79 | 80 | 81 | 82 | ### 4图形输出 83 | 84 | - [x] |B1036 | [ 跟奥巴马一起编程](https://pintia.cn/problem-sets/994805260223102976/problems/994805285812551680) 85 | - [x] | B1027 | [ 打印沙漏](https://pintia.cn/problem-sets/994805260223102976/problems/994805294251491328) 86 | - [x] | A1031 | [ Hello World for U](https://pintia.cn/problem-sets/994805342720868352/problems/994805462535356416) 87 | 88 | 89 | 90 | ### 5日期处理 91 | 92 | - 无 93 | 94 | 95 | 96 | ### 6进制转换 97 | 98 | - [x] | B1022 | [D进制的A+B](https://pintia.cn/problem-sets/994805260223102976/problems/994805299301433344) 99 | - [x] | B1037 | [在霍格沃茨找零钱](https://pintia.cn/problem-sets/994805260223102976/problems/994805284923359232) 100 | - [x] | A1019 | [General Palindromic Number](https://pintia.cn/problem-sets/994805342720868352/problems/994805487143337984) 101 | - [x] | A1027 | [ Colors in Mars](https://pintia.cn/problem-sets/994805342720868352/problems/994805470349344768) 102 | - [x] | A1058 | [ A+B in Hogwarts](https://pintia.cn/problem-sets/994805342720868352/problems/994805416519647232) 103 | 104 | 105 | 106 | ### 7字符串处理 107 | 108 | - [x] B1006 | [换个格式输出整数](https://pintia.cn/problem-sets/994805260223102976/problems/994805318855278592) 109 | - [x] B1021 | [个位数统计](https://pintia.cn/problem-sets/994805260223102976/problems/994805300404535296) 110 | - [x] B1031 | [查验身份证](https://pintia.cn/problem-sets/994805260223102976/problems/994805290334011392) 111 | - [x] B1002 | [ 写出这个数](https://pintia.cn/problem-sets/994805260223102976/problems/994805324509200384) 112 | - [x] B1009 | [ 说反话](https://pintia.cn/problem-sets/994805260223102976/problems/994805314941992960) 113 | - [x] B1014 |[ 福尔摩斯的约会](https://pintia.cn/problem-sets/994805260223102976/problems/994805308755394560)/A1061[Dating](https://pintia.cn/problem-sets/994805342720868352/problems/994805411985604608) | 同样代码AC 114 | - [x] B1024 |[科学计数法](https://pintia.cn/problem-sets/994805260223102976/problems/994805297229447168)A1073[Scientific Notation](https://pintia.cn/problem-sets/994805342720868352/problems/994805395707510784) 115 | - [x] B1048 | [ 数字加密](https://pintia.cn/problem-sets/994805260223102976/problems/994805276438282240) 116 | - [x] A1001 | [ A+B Format](https://pintia.cn/problem-sets/994805342720868352/problems/994805528788582400) 117 | - [x] A1005 | [ Spell It Right](https://pintia.cn/problem-sets/994805342720868352/problems/994805519074574336) 118 | - [x] A1035 | [Password](https://pintia.cn/problem-sets/994805342720868352/problems/994805454989803520) 119 | - [x] A1077 | [ Kuchiguse](https://pintia.cn/problem-sets/994805342720868352/problems/994805390896644096) 120 | - [ ] A1082 | [Read Number in Chinese](https://pintia.cn/problem-sets/994805342720868352/problems/994805385053978624) 121 | 122 | 123 | 124 | ## 02.算法初步(常用简单算法) 125 | 126 | 127 | 128 | ### 1排序 129 | 130 | **『很好的训练,cmp函数、结构体设计的一组训练』** 131 | 132 | - [x] | B1015[ 德才论](https://pintia.cn/problem-sets/994805260223102976/problems/994805307551629312)/A1062[Talent and Virtue](https://pintia.cn/problem-sets/994805342720868352/problems/994805410555346944) 133 | - [ ] | A1012 | [The Best Rank](https://pintia.cn/problem-sets/994805342720868352/problems/994805502658068480) 134 | - [ ] | A1016 | [ Phone Bills](https://pintia.cn/problem-sets/994805342720868352/problems/994805493648703488) 135 | - [x] | A1025 | [ PAT Ranking](https://pintia.cn/problem-sets/994805342720868352/problems/994805474338127872) 136 | - [x] | A1028 | [ List Sorting](https://pintia.cn/problem-sets/994805342720868352/problems/994805468327690240) 137 | - [ ] | A1055 | [ The World's Richest](https://pintia.cn/problem-sets/994805342720868352/problems/994805421066272768) 138 | - [ ] | A1075 | [ PAT Judge](https://pintia.cn/problem-sets/994805342720868352/problems/994805393241260032) 139 | - [x] | A1083 | [ List Grades](https://pintia.cn/problem-sets/994805342720868352/problems/994805383929905152) 140 | - [ ] | A1080 | [ Graduate Admission](https://pintia.cn/problem-sets/994805342720868352/problems/994805387268571136) 141 | - [ ] | A1095 | [ Cars on Campus](https://pintia.cn/problem-sets/994805342720868352/problems/994805371602845696) 142 | 143 | 144 | 145 | ### 2散列(哈希) 146 | 147 | - [x] | B1029[旧键盘](https://pintia.cn/problem-sets/994805260223102976/problems/994805292322111488)/1084[Broken Keyboard](https://pintia.cn/problem-sets/994805342720868352/problems/994805382902300672) | 148 | - [x] | B1033 | [ 旧键盘打字](https://pintia.cn/problem-sets/994805260223102976/problems/994805288530460672) 149 | - [x] | B1038 | [ 统计同成绩学生](https://pintia.cn/problem-sets/994805260223102976/problems/994805284092887040) 150 | - [x] | B1039 |[ 到底买不买](https://pintia.cn/problem-sets/994805260223102976/problems/994805283241443328)/A1092[ To Buy or Not to Buy](https://pintia.cn/problem-sets/994805342720868352/problems/994805374509498368) 151 | - [x] | B1042 | [ 字符统计](https://pintia.cn/problem-sets/994805260223102976/problems/994805280817135616) 152 | - [x] | B1043 | [输出PATest](https://pintia.cn/problem-sets/994805260223102976/problems/994805280074743808) 153 | - [x] | B1047 | [编程团体赛](https://pintia.cn/problem-sets/994805260223102976/problems/994805277163896832) 154 | - [x] | A1041 | [ Be Unique](https://pintia.cn/problem-sets/994805342720868352/problems/994805444361437184) 155 | - [x] | A1050 | [ String Subtraction](https://pintia.cn/problem-sets/994805342720868352/problems/994805429018673152) 156 | - [x] | B1005 | [继续(3n+1)猜想](https://pintia.cn/problem-sets/994805260223102976/problems/994805320306507776) 157 | - [x] | A1048 | [ Find Coins](https://pintia.cn/problem-sets/994805342720868352/problems/994805432256675840) 158 | 159 | 160 | 161 | ### 3递归 162 | 163 | - 编程技巧-不算算法 164 | - 体验这种编程技巧,最好的方式,刷数据结构之『树』 165 | 166 | 167 | 168 | - [ ] 百练2802:[小游戏](http://bailian.openjudge.cn/practice/2802) 169 | - [ ] 百练1191:[棋盘分割](http://bailian.openjudge.cn/practice/1191) 170 | - [ ] 百练2754:[八皇后](http://bailian.openjudge.cn/practice/2754) 171 | - [ ] 百练2775:[文件结构“图”](http://bailian.openjudge.cn/practice/2775) 172 | - [x] 百练2787:[算24](http://bailian.openjudge.cn/practice/2787) 173 | - [x] 百练2753:[菲波那契数列](http://bailian.openjudge.cn/practice/2753) 174 | - [x] 百练3248:[最大公约数](http://bailian.openjudge.cn/practice/3248) 175 | - [ ] 百练2749:[分解因数](http://bailian.openjudge.cn/practice/2749) 176 | - [ ] 百练2694:[逆波兰表达式](http://bailian.openjudge.cn/practice/2694) 177 | - [ ] 百练3704:[扩号匹配问题](http://bailian.openjudge.cn/practice/3704) 178 | 179 | 180 | 181 | 182 | 183 | ### 4贪心 184 | 185 | - [x] | B1023 | [组个最小数](https://pintia.cn/problem-sets/994805260223102976/problems/994805298269634560) 186 | - [ ] | B1020 |[月饼](https://pintia.cn/problem-sets/994805260223102976/problems/994805301562163200)/A1070[Mooncake](https://pintia.cn/problem-sets/994805342720868352/problems/994805399578853376) | 187 | - [ ] | A1033 | [To Fill or Not to Fill](https://pintia.cn/problem-sets/994805342720868352/problems/994805458722734080) 188 | - [ ] | A1037 | [Magic Coupon](https://pintia.cn/problem-sets/994805342720868352/problems/994805451374313472) 189 | - [ ] | A1067 | [ Sort with Swap(0, i)](https://pintia.cn/problem-sets/994805342720868352/problems/994805403651522560) 190 | - [ ] | A1038 | [ Recover the Smallest Number](https://pintia.cn/problem-sets/994805342720868352/problems/994805449625288704) 191 | - [x] 百练4110:[圣诞老人的礼物](http://bailian.openjudge.cn/practice/4110)-Santa Clau’s Gifts 192 | - [ ] 百练3468:[电池的寿命](http://bailian.openjudge.cn/practice/3468) 193 | - [ ] 百练1328:Radar Installation([建立雷达](http://bailian.openjudge.cn/practice/1328)) 194 | - [ ] 百练2287:Tian Ji -- The Horse Racing([田忌赛马](http://bailian.openjudge.cn/practice/2287)) 195 | - [ ] 百练1042:Gone Fishing([钓鱼](http://bailian.openjudge.cn/practice/1042)) 196 | - [ ] 百练4144:[畜栏保留问题](http://bailian.openjudge.cn/practice/4144) 197 | - [ ] 百练2795:[金银岛](http://bailian.openjudge.cn/practice/2795) 198 | - [ ] 百练2797:[最短前缀](http://bailian.openjudge.cn/practice/2797) 199 | - [x] 百练3406:[书架](http://bailian.openjudge.cn/practice/3406) 200 | - [ ] 百练4137:[最小新整数](http://bailian.openjudge.cn/practice/4137)『未』 201 | - [ ] 百练4005:[拼点游戏](http://bailian.openjudge.cn/practice/4005)『未』 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | ### 5二分 210 | 211 | - [x] | B1030[ 完美数列](https://pintia.cn/problem-sets/994805260223102976/problems/994805291311284224)/A1085[Perfect Sequence](https://pintia.cn/problem-sets/994805342720868352/problems/994805381845336064) 212 | - [ ] | A1010 | [Radix](https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536) 213 | - [ ] | A1044 | [ Favorite Color Stripe](https://pintia.cn/problem-sets/994805342720868352/problems/994805437411475456) 214 | - [x] | A1048 | [ Find Coins](https://pintia.cn/problem-sets/994805342720868352/problems/994805432256675840) (亦是散列) 215 | - [x] 百练4140: [方程求解](http://bailian.openjudge.cn/practice/4140) 216 | - [x] 百练2503:Babelfish : [在线翻译](http://bailian.openjudge.cn/practice/2503)「学习输入和输出技巧」 217 | - [x] 百练3441:4 Values whose Sum is 0([快速找到和为0的4个数](http://bailian.openjudge.cn/practice/3441)) 218 | - [ ] 百练2456:Aggressive cows([疯牛](http://bailian.openjudge.cn/practice/2456)) 219 | - [ ] 百练1905:Expanding Rods([弯曲的木杆](http://bailian.openjudge.cn/practice/1905)) 220 | - [ ] 百练4145:[放弃考试](http://bailian.openjudge.cn/practice/4145) 221 | - [ ] 百练4134:[查找最接近的元素](http://bailian.openjudge.cn/practice/4134) 222 | - [ ] 百练4142:[二分法求函数的零点](http://bailian.openjudge.cn/practice/4142) 223 | - [ ] 百练4143:[和为给定数](http://bailian.openjudge.cn/practice/4143) 224 | - [ ] 百练4135:[月度开销](http://bailian.openjudge.cn/practice/4135) 225 | - [ ] 百练4136:[矩形分割](http://bailian.openjudge.cn/practice/4136) 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | ### 6two pointers(双指针) 234 | 235 | - [x] | B1030[完美数列](https://pintia.cn/problem-sets/994805260223102976/problems/994805291311284224)/A1085[Perfect Sequence](https://pintia.cn/problem-sets/994805342720868352/problems/994805381845336064) 236 | - [ ] | B1035[ 插入与归并](https://pintia.cn/problem-sets/994805260223102976/problems/994805286714327040)/A1089[Insert or Merge](https://pintia.cn/problem-sets/994805342720868352/problems/994805377432928256) | 237 | - [ ] | A1029 | [ Median](https://pintia.cn/problem-sets/994805342720868352/problems/994805466364755968) 238 | - [ ] | A1048 | [Find Coins](https://pintia.cn/problem-sets/994805342720868352/problems/994805432256675840) 239 | 240 | 241 | 242 | ### 7其他高效技巧与算法 243 | 244 | - [x] | B1040[有几个PAT](https://pintia.cn/problem-sets/994805260223102976/problems/994805282389999616)/A1093[ Count PAT's](https://pintia.cn/problem-sets/994805342720868352/problems/994805373582557184) | 245 | - [ ] | B1045[ 快速排序](https://pintia.cn/problem-sets/994805260223102976/problems/994805278589960192)/A1101[ Quick Sort](https://pintia.cn/problem-sets/994805342720868352/problems/994805366343188480) | | 246 | 247 | 248 | 249 | ## 03.数学问题 250 | 251 | ### 1简单数学 252 | 253 | - [ ] | B1003 | [我要通过!](https://pintia.cn/problem-sets/994805260223102976/problems/994805323154440192) | 『考英语阅读理解的既视感:arrow_left:』 254 | - [x] | B1019[ 数字黑洞](https://pintia.cn/problem-sets/994805260223102976/problems/994805302786899968)/A1069[ The Black Hole of Numbers](https://pintia.cn/problem-sets/994805342720868352/problems/994805400954585088) | 255 | - [x] | B1049[ 数列的片段和](https://pintia.cn/problem-sets/994805260223102976/problems/994805275792359424)/A1104[Sum of Number Segments](https://pintia.cn/problem-sets/994805342720868352/problems/994805363914686464) | 『找规律好题』 256 | - [x] | A1008 | [Elevator](https://pintia.cn/problem-sets/994805342720868352/problems/994805511923286016) | 257 | - [ ] | A1049 | [Counting Ones](https://pintia.cn/problem-sets/994805342720868352/problems/994805430595731456) | 258 | 259 | 260 | 261 | ### 2最大公约数和最小公倍数 262 | 263 | - [x] | B1008 | [ 数组元素循环右移问题](https://pintia.cn/problem-sets/994805260223102976/problems/994805316250615808) | 264 | 265 | 266 | 267 | ### 3分数的四则运算 268 | 269 | - [ ] | A1081 | [Rational Sum](https://pintia.cn/problem-sets/994805342720868352/problems/994805386161274880) 270 | - [ ] | B1034[有理数四则运算](https://pintia.cn/problem-sets/994805260223102976/problems/994805287624491008)/A1088[ Rational Arithmetic](https://pintia.cn/problem-sets/994805342720868352/problems/994805378443755520) | 271 | 272 | 273 | 274 | ### 4素数 275 | 276 | - [ ] | B1007 | [ 素数对猜想](https://pintia.cn/problem-sets/994805260223102976/problems/994805317546655744) 277 | - [ ] | B1013 | [ 数素数](https://pintia.cn/problem-sets/994805260223102976/problems/994805309963354112) 278 | - [ ] | A1015 | [Reversible Primes](https://pintia.cn/problem-sets/994805342720868352/problems/994805495863296000) 279 | - [ ] | A1078 | [ Hashing](https://pintia.cn/problem-sets/994805342720868352/problems/994805389634158592) 280 | 281 | 282 | 283 | 284 | 285 | ### 5质因子分解 286 | 287 | - [ ] | A1096 | [ Consecutive Factors](https://pintia.cn/problem-sets/994805342720868352/problems/994805370650738688) | 288 | - [ ] | A1059 | [ Prime Factors](https://pintia.cn/problem-sets/994805342720868352/problems/994805415005503488) | 289 | 290 | 291 | 292 | ### 6大整数运算 293 | 294 | 295 | 296 | - [ ] | B1017 | [ A除以B](https://pintia.cn/problem-sets/994805260223102976/problems/994805305181847552) | 297 | - [ ] | A1023 | [Have Fun with Numbers](https://pintia.cn/problem-sets/994805342720868352/problems/994805478658260992) | 298 | - [ ] | A1024 | [Palindromic Number](https://pintia.cn/problem-sets/994805342720868352/problems/994805476473028608) | 299 | 300 | 301 | 302 | ### 7扩展欧几里得(非ACM选手没必要看) 303 | 304 | - 无 305 | 306 | 307 | 308 | ### 8组合数 309 | 310 | - 无 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | ## 04.数据结构之链表、栈、队列 320 | 321 | ### 1栈 322 | 323 | - [ ] | A1051 | [Pop Sequence](https://pintia.cn/problem-sets/994805342720868352/problems/994805427332562944) | 324 | 325 | 326 | 327 | ### 2队列 328 | 329 | - [ ] | A1056 | [Mice and Rice](https://pintia.cn/problem-sets/994805342720868352/problems/994805419468242944) 330 | 331 | 332 | 333 | ### 3链表 334 | 335 | - [ ] | B1025[ 反转链表](https://pintia.cn/problem-sets/994805260223102976/problems/994805296180871168)/A1074[ Reversing Linked List](https://pintia.cn/problem-sets/994805342720868352/problems/994805394512134144) | 336 | - [ ] | A1032 | [Sharing](https://pintia.cn/problem-sets/994805342720868352/problems/994805460652113920) | 337 | - [ ] | A1052 | [ Linked List Sorting](https://pintia.cn/problem-sets/994805342720868352/problems/994805425780670464) | 338 | - [ ] | A1097 | [ Deduplication on a Linked List](https://pintia.cn/problem-sets/994805342720868352/problems/994805369774129152) | 339 | 340 | 341 | 342 | ## 05.算法之搜索 343 | 344 | ### 1DFS 345 | 346 | - [ ] | A1103 | [ Integer Factorization](https://pintia.cn/problem-sets/994805342720868352/problems/994805364711604224) 347 | - [ ] 百练2815:[城堡问题](http://bailian.openjudge.cn/practice/2815) 348 | - [ ] 百练1724:[ROADS](http://bailian.openjudge.cn/practice/1724) 349 | - [ ] 百练1190:[生日蛋糕](http://bailian.openjudge.cn/practice/1190) 350 | - [ ] 百练1011:[Sticks](http://bailian.openjudge.cn/practice/1011) 351 | - [ ] 百练4103:[踩方格](http://bailian.openjudge.cn/practice/4103) 352 | - [ ] 百练1321:[棋盘问题](http://bailian.openjudge.cn/practice/1321) 353 | - [ ] 百练4123:[马走日](http://bailian.openjudge.cn/practice/4123) 354 | - [ ] 百练4124:[海贼王之伟大航路](http://bailian.openjudge.cn/practice/4124) 355 | - [ ] 百练4126:[DNA](http://bailian.openjudge.cn/practice/4126) 356 | 357 | 358 | 359 | 360 | 361 | ### 2BFS 362 | 363 | - [ ] | A1091 | [ Acute Stroke](https://pintia.cn/problem-sets/994805342720868352/problems/994805375457411072) 364 | - [ ] 百练4001:[抓住那头牛](http://bailian.openjudge.cn/practice/4001) 365 | - [ ] 百练4116:[拯救行动](http://bailian.openjudge.cn/practice/4116) 366 | - [ ] 百练4115:[鸣人和佐助](http://bailian.openjudge.cn/practice/4115) 367 | - [ ] 百练1077:Eight([八数码](http://bailian.openjudge.cn/practice/1077)) 368 | - [ ] 百练4127:[迷宫问题](http://bailian.openjudge.cn/practice/4127) 369 | - [ ] 百练4128:[单词序列](http://bailian.openjudge.cn/practice/4128) 370 | - [ ] 百练4129:[变换的迷宫](http://bailian.openjudge.cn/practice/4129) 371 | - [ ] 百练1753:[Flip Game](http://bailian.openjudge.cn/practice/1753) 372 | - [ ] 百练4130:[Saving Tang Monk](http://bailian.openjudge.cn/practice/4130) 373 | - [ ] 百练1729:[Jack and Jill](http://bailian.openjudge.cn/practice/1729) 374 | 375 | 376 | 377 | 378 | 379 | ## 06.数据结构之树 380 | 381 | - 树和二叉树 382 | 383 | ### 二叉树的遍历 384 | 385 | - [x] | A1020 | [ Tree Traversals](https://pintia.cn/problem-sets/994805342720868352/problems/994805485033603072) 『中序+后序』 386 | - [ ] | A1086 | [Tree Traversals Again](https://pintia.cn/problem-sets/994805342720868352/problems/994805380754817024) 『中序+前序』 387 | - [ ] | A1102 | [ Invert a Binary Tree](https://pintia.cn/problem-sets/994805342720868352/problems/994805365537882112) 388 | 389 | 390 | 391 | ### 树的遍历 392 | 393 | - [ ] | A1079 | [Total Sales of Supply Chain](https://pintia.cn/problem-sets/994805342720868352/problems/994805388447170560) 394 | - [ ] | A1090 | [ Highest Price in Supply Chain](https://pintia.cn/problem-sets/994805342720868352/problems/994805376476626944) 395 | - [ ] | A1094 | [ The Largest Generation](https://pintia.cn/problem-sets/994805342720868352/problems/994805372601090048) 396 | - [ ] | A1106 | [ Lowest Price in Supply Chain](https://pintia.cn/problem-sets/994805342720868352/problems/994805362341822464) 397 | - [ ] | A1004 | [Counting Leaves](https://pintia.cn/problem-sets/994805342720868352/problems/994805521431773184) 398 | - [ ] | A1053 | [Path of Equal Weight](https://pintia.cn/problem-sets/994805342720868352/problems/994805424153280512) 399 | 400 | 401 | 402 | ### 二叉查找树 403 | 404 | - [ ] | A1043 | [ Is It a Binary Search Tree](https://pintia.cn/problem-sets/994805342720868352/problems/994805440976633856) 405 | - [ ] | A1064 | [Complete Binary Search Tree](https://pintia.cn/problem-sets/994805342720868352/problems/994805407749357568) 406 | - [ ] | A1099 | [Build A Binary Search Tree](https://pintia.cn/problem-sets/994805342720868352/problems/994805367987355648) 407 | 408 | 409 | 410 | ### 平衡二叉树 411 | 412 | - [ ] | A1066 | [Root of AVL Tree](https://pintia.cn/problem-sets/994805342720868352/problems/994805404939173888) 413 | 414 | 415 | 416 | ### 并查集(重要) 417 | 418 | - [ ] | A1107 | [ Social Clusters](https://pintia.cn/problem-sets/994805342720868352/problems/994805361586847744) 419 | 420 | 421 | 422 | ### 堆 423 | 424 | - [ ] | A1098 | [ Insertion or Heap Sort](https://pintia.cn/problem-sets/994805342720868352/problems/994805368847187968) 425 | 426 | 427 | 428 | - 赫夫曼树(哈夫曼树) 429 | 430 | 431 | 432 | ## 07.图论 433 | 434 | - 图的定义和相关术语 435 | - 图的存储 436 | 437 | ### 图的遍历 438 | 439 | - [ ] | A1013 | [ Battle Over Cities](https://pintia.cn/problem-sets/994805342720868352/problems/994805500414115840) 440 | - [ ] | A1021 | [Deepest Root](https://pintia.cn/problem-sets/994805342720868352/problems/994805482919673856) 441 | - [ ] | A1024 | [Palindromic Number](https://pintia.cn/problem-sets/994805342720868352/problems/994805476473028608) 442 | - [ ] | A1076 | [ Forwards on Weibo](https://pintia.cn/problem-sets/994805342720868352/problems/994805392092020736) 443 | 444 | 445 | 446 | ### 最短路径 447 | 448 | - [ ] | A1003 | [Emergency](https://pintia.cn/problem-sets/994805342720868352/problems/994805523835109376) 449 | - [ ] | A1018 | [Public Bike Management](https://pintia.cn/problem-sets/994805342720868352/problems/994805489282433024) 450 | - [ ] | A1030 | [ Travel Plan](https://pintia.cn/problem-sets/994805342720868352/problems/994805464397627392) 451 | - [ ] | A1072 | [Gas Station](https://pintia.cn/problem-sets/994805342720868352/problems/994805396953219072) 452 | - [ ] | A1087 | [All Roads Lead to Rome](https://pintia.cn/problem-sets/994805342720868352/problems/994805379664297984) 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | - 最小生成树 461 | - 拓扑排序 462 | - 关键路径 463 | 464 | 465 | 466 | ## 08.动态规划 467 | 468 | - 动态规划的递归和递推写法(准确说是迭代) 469 | - 最大连续子序列和A1007[ Maximum Subsequence Sum](https://pintia.cn/problem-sets/994805342720868352/problems/994805514284679168) 470 | - 最长不下降子序列(LIS)A1045[Favorite Color Stripe](https://pintia.cn/problem-sets/994805342720868352/problems/994805437411475456) 471 | - 最长公共子序列(LCS)A1045[Favorite Color Stripe](https://pintia.cn/problem-sets/994805342720868352/problems/994805437411475456) 472 | - 最长回文子串A1040[ Longest Symmetric String](https://pintia.cn/problem-sets/994805342720868352/problems/994805446102073344) 473 | - DAG最长路 474 | - 背包问题A1068[ Find More Coins](https://pintia.cn/problem-sets/994805342720868352/problems/994805402305150976) 475 | 476 | 477 | 478 | - [ ] 百练2533:Longest Ordered Subsequence([最长上升子序列](http://bailian.openjudge.cn/practice/2533)) 479 | - [ ] 百练1458:Common Subsequence([最长公共子序列](http://bailian.openjudge.cn/practice/1458)) 480 | - [ ] 百练4131:[Charm Bracelet](http://bailian.openjudge.cn/practice/4131) 481 | - [ ] 百练1088:[滑雪](http://bailian.openjudge.cn/practice/1088) 482 | - [ ] 百练2373:Dividing the Path([灌溉草场](http://bailian.openjudge.cn/practice/2373)) 483 | - [ ] 百练1390:Blocks([方盒游戏](http://bailian.openjudge.cn/practice/1390)) 484 | - [ ] 百练1037:A decorative fence([美妙珊栏](http://bailian.openjudge.cn/practice/1037)) 485 | - [ ] 百练4117:[简单的整数划分问题](http://bailian.openjudge.cn/practice/4117) 486 | - [ ] 百练4118:[开餐馆](http://bailian.openjudge.cn/practice/4118) 487 | - [ ] 百练4119:[复杂的整数划分问题](http://bailian.openjudge.cn/practice/4119) 488 | - [ ] 百练4120:[硬币](http://bailian.openjudge.cn/practice/4120) 489 | - [ ] 百练4102:[宠物小精灵之收服](http://bailian.openjudge.cn/practice/4102) 490 | - [ ] 百练4121:[股票买卖](http://bailian.openjudge.cn/practice/4121) 491 | - [ ] 百练4122:[切割回文](http://bailian.openjudge.cn/practice/4122) 492 | 493 | 494 | 495 | 496 | 497 | 498 | ## 09.高级字符串算法 499 | 500 | - 字符串hash A1040[Longest Symmetric String](https://pintia.cn/problem-sets/994805342720868352/problems/994805446102073344) 501 | - KMP算法 502 | 503 | 504 | 505 | 506 | 507 | ## 10.其他高级数据结构(ACM类) 508 | 509 | 510 | - 分块思想/树状数组: 511 | - [ ] A1057[Stack](https://pintia.cn/problem-sets/994805342720868352/problems/994805417945710592) 512 | - 快乐模拟: 513 | - [ ] | B1050[ 螺旋矩阵](https://pintia.cn/problem-sets/994805260223102976/problems/994805275146436608)/A1105[ Spiral Matrix](https://pintia.cn/problem-sets/994805342720868352/problems/994805363117768704) | 514 | - [ ] | A1017 | [ Eddington Number](https://pintia.cn/problem-sets/994805342720868352/problems/994805354762715136) 515 | - [ ] | A1014 | [ Family Property](https://pintia.cn/problem-sets/994805342720868352/problems/994805356599820288) 516 | - [ ] | A1026 | [Eulerian Path](https://pintia.cn/problem-sets/994805342720868352/problems/994805349851185152) 517 | 518 | 519 | 520 | -------------------------------------------------------------------------------- /00.Pre/Part03.STL刷题目录.md: -------------------------------------------------------------------------------- 1 | # 『STL』强化训练 2 | 3 | - C++刷题中精简代码最常用的『STL』 4 | 5 | 6 | 7 | ## 1 vector常用用法 8 | 9 | - [x] | A1039 | [Course List for Student](https://pintia.cn/problem-sets/994805342720868352/problems/994805447855292416) | 『我用的string,map,set』 10 | - [x] | A1047 | [Student List for Course](https://pintia.cn/problem-sets/994805342720868352/problems/994805433955368960) | 11 | 12 | 13 | 14 | 15 | 16 | ## 2 list常用用法 17 | 18 | 19 | 20 | ## 2 set的常用用法 21 | 22 | - [x] | A1063 | [ Set Similarity](https://pintia.cn/problem-sets/994805342720868352/problems/994805409175420928) | 23 | 24 | 25 | 26 | ## 3 string的常用用法 27 | 28 | - [ ] | A1060 | [Are They Equal](https://pintia.cn/problem-sets/994805342720868352/problems/994805413520719872) | 29 | 30 | 31 | 32 | ## 4 map的常用用法 33 | 34 | - [x] | B1044[ 火星数字](https://pintia.cn/problem-sets/994805260223102976/problems/994805279328157696)/A1100[ Mars Numbers](https://pintia.cn/problem-sets/994805342720868352/problems/994805367156883456) | 35 | - [x] | A1054 | [ The Dominant Color](https://pintia.cn/problem-sets/994805342720868352/problems/994805422639136768) | 36 | - [x] | A1071 | [ Speech Patterns](https://pintia.cn/problem-sets/994805342720868352/problems/994805398257647616) | 『isalnum和map的count寻找个数』 37 | - [ ] | A1022 | [ Digital Library](https://pintia.cn/problem-sets/994805342720868352/problems/994805480801550336) | 38 | 39 | 40 | 41 | ## 5 queue的常用用法 42 | 43 | - 无 44 | 45 | ## 6 priority_queue的常见用法 46 | 47 | - 无 48 | 49 | 50 | 51 | ## 7 stack的常见用法 52 | 53 | - 无 54 | 55 | 56 | 57 | ## 8 pair的常见用法 58 | 59 | - [字符统计](https://www.nowcoder.com/questionTerminal/c1f9561de1e240099bdb904765da9ad0) 60 | 61 | 62 | 63 | ## 9 heap的使用 64 | 65 | - [找到无序数组中最小的k个数](https://www.nowcoder.com/questionTerminal/b3c88bb9acda4d0cb6a2f50e45739332) 66 | 67 | - [1046. 最后一块石头的重量](https://leetcode-cn.com/problems/last-stone-weight/) 68 | 69 | 70 | 71 | ## 10 algorithm下的常用函数 72 | 73 | - 无 -------------------------------------------------------------------------------- /01.PAT/03.顶级C++11版本.md: -------------------------------------------------------------------------------- 1 | # PAT顶级目录 2 | 3 | 4 | 5 | | 题号 | | | 6 | | ---- | ------------------------------------------------------------ | ---- | 7 | | 1001 | [Battle Over Cities - Hard Version](https://pintia.cn/problem-sets/994805148990160896/problems/994805156657348608) | | 8 | | 1002 | [Business](https://pintia.cn/problem-sets/994805148990160896/problems/994805156145643520) | | 9 | | 1003 | [Universal Travel Sites](https://pintia.cn/problem-sets/994805148990160896/problems/994805155688464384) | | 10 | | 1004 | [To Buy or Not to Buy - Hard Version](https://pintia.cn/problem-sets/994805148990160896/problems/994805155206119424) | | 11 | | 1005 | [Programming Pattern](https://pintia.cn/problem-sets/994805148990160896/problems/994805154748940288) | | 12 | | 1006 | [Tree Traversals - Hard Version](https://pintia.cn/problem-sets/994805148990160896/problems/994805154321121280) | | 13 | | 1007 | [Red-black Tree](https://pintia.cn/problem-sets/994805148990160896/problems/994805153880719360) | | 14 | | 1008 | [Airline Routes](https://pintia.cn/problem-sets/994805148990160896/problems/994805153478066176) | | 15 | | 1009 | [Triple Inversions](https://pintia.cn/problem-sets/994805148990160896/problems/994805153092190208) | | 16 | | 1010 | [Lehmer Code](https://pintia.cn/problem-sets/994805148990160896/problems/994805152735674368) | | 17 | | 1011 | [Cut Rectangles](https://pintia.cn/problem-sets/994805148990160896/problems/994805152379158528) | | 18 | | 1012 | [Greedy Snake](https://pintia.cn/problem-sets/994805148990160896/problems/994805152010059776) | | 19 | | 1013 | [Image Segmentation](https://pintia.cn/problem-sets/994805148990160896/problems/994805151670321152) | | 20 | | 1014 | [Circles of Friends](https://pintia.cn/problem-sets/994805148990160896/problems/994805151343165440) | | 21 | | 1015 | [Letter-moving Game](https://pintia.cn/problem-sets/994805148990160896/problems/994805151045369856) | | 22 | | 1016 | [Uniqueness of MST](https://pintia.cn/problem-sets/994805148990160896/problems/994805150751768576) | | 23 | | 1017 | [The Best Peak Shape](https://pintia.cn/problem-sets/994805148990160896/problems/994805150479138816) | | 24 | | 1018 | [Subnumbers](https://pintia.cn/problem-sets/994805148990160896/problems/994805150219091968) | | 25 | | 1019 | [Separate the Animals](https://pintia.cn/problem-sets/994805148990160896/problems/994805149963239424) | | 26 | | 1020 | [Delete At Most Two Characters](https://pintia.cn/problem-sets/994805148990160896/problems/994805149732552704) | | 27 | | 1021 | [Safe Fruit](https://pintia.cn/problem-sets/994805148990160896/problems/994805149506060288) | | 28 | | 1022 | [Werewolf](https://pintia.cn/problem-sets/994805148990160896/problems/994805149279567872) | | 29 | | 1023 | [The Best Polygon](https://pintia.cn/problem-sets/994805148990160896/problems/994805149061464064) | | 30 | | 1024 | [Currency Exchange Centers](https://pintia.cn/problem-sets/994805148990160896/problems/1038430372098768896) | | 31 | | 1025 | [Keep at Most 100 Characters](https://pintia.cn/problem-sets/994805148990160896/problems/1038430487337271296) | | 32 | | 1026 | [String of Colorful Beads](https://pintia.cn/problem-sets/994805148990160896/problems/1071784456138059776) | | 33 | | 1027 | [Larry and Inversions](https://pintia.cn/problem-sets/994805148990160896/problems/1071784623285268480) | | 34 | 35 | -------------------------------------------------------------------------------- /01.PAT/PAT目录结构.md: -------------------------------------------------------------------------------- 1 | # 目录 2 | 3 | 4 | 5 | ## [01.乙级C++11版本](./01.PAT/01.乙级C++11版本.md) 6 | 7 | 8 | ## [02.甲级C++11版本](./01.PAT/02.甲级C++11版本.md) 9 | 10 | ## [03.顶级C++11版本](./01.PAT/03.顶级C++11版本.md) 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /02.CCF_CSP/2013年/2013年12月.md: -------------------------------------------------------------------------------- 1 | # 2013年12月 2 | 3 | (CSP开考) 4 | 5 | 注意,由于CCF不实时显示得分,所以,我们要自行测试**边界数据** 6 | 7 | 会做的一定要得到100 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ## 一、出现次数最多的数 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ### C++11写法 24 | 25 | (注意,记得要选DevC++11,如果只是普通的DevC++可能会编译出错) 26 | 27 | 我的下面代码“编译出错??”但是在本地却可以AC,本地dev `C++` ,我开启了 `C++11` 编译选项 28 | 29 | 30 | 31 | - 划重点:CSP中 32 | 33 | `“DevC++语言,编译选项”,不支持C++11` 34 | 35 | `DevC++语言C++11标准` 36 | 37 | - 但是支持`#include` 38 | 39 | 40 | 41 | 42 | 43 | ```cpp 44 | 45 | //这个头文件,测试是否是Linux下分判题系统 46 | 47 | #include 48 | 49 | using namespace std; 50 | 51 | 52 | 53 | static const int maxn=10000+5; 54 | 55 | int numHash[maxn]; 56 | 57 | 58 | 59 | 60 | 61 | int main() 62 | 63 | { 64 | 65 | int n; 66 | 67 | while( ~scanf("%d",&n) ) 68 | 69 | { 70 | 71 | memset( numHash, sizeof(numHash), 0); 72 | 73 | 74 | 75 | int temp; 76 | 77 | while( n-- ) 78 | 79 | { 80 | 81 | scanf("%d",&temp); 82 | 83 | numHash[temp]++; 84 | 85 | } 86 | 87 | 88 | 89 | int maxNum=-6666; 90 | 91 | //这种遍历方式测试,g++是否支持C++11 92 | 93 | for(int i : numHash ) 94 | 95 | { 96 | 97 | maxNum=max( maxNum, i); 98 | 99 | } 100 | 101 | 102 | 103 | int rt; 104 | 105 | for(int i=1; i 148 | 149 | using namespace std; 150 | 151 | 152 | 153 | const int maxn=10000+5; 154 | 155 | int _hash[maxn]; 156 | 157 | 158 | 159 | int main() 160 | 161 | { 162 | 163 | 164 | 165 | int n; 166 | 167 | while(~scanf("%d",&n)) 168 | 169 | { 170 | 171 | memset(_hash,0,sizeof(_hash)); 172 | 173 | 174 | 175 | int temp; 176 | 177 | for(int i=0;i 274 | 275 | using namespace std; 276 | 277 | 278 | 279 | int num[10]; 280 | 281 | map mp; 282 | 283 | void init() 284 | 285 | { 286 | 287 | for(int i=0; i<10; ++i) 288 | 289 | { 290 | 291 | mp[i]='0'+i; 292 | 293 | } 294 | 295 | 296 | 297 | mp[10]='X'; 298 | 299 | } 300 | 301 | 302 | 303 | int main() 304 | 305 | { 306 | 307 | char solve[15]; 308 | 309 | init(); 310 | 311 | 312 | 313 | while( NULL!=gets(solve) ) 314 | 315 | { 316 | 317 | int tag=1; 318 | 319 | //注意扫描到9+2之前就好了 320 | 321 | for(int i=0; i<11 ; ++i) 322 | 323 | { 324 | 325 | if( '-'!=solve[i] ) 326 | 327 | { 328 | 329 | num[tag++]=solve[i]-'0'; 330 | 331 | } 332 | 333 | } 334 | 335 | 336 | 337 | int sum=0; 338 | 339 | for(int i=1; i<=9; ++i) 340 | 341 | { 342 | 343 | sum+=( i *num[i] ); 344 | 345 | 346 | 347 | } 348 | 349 | 350 | 351 | 352 | 353 | sum%=11; 354 | 355 | char test=mp[sum]; 356 | 357 | 358 | 359 | 360 | 361 | if( test==solve[12] ) 362 | 363 | { 364 | 365 | printf("Right\n"); 366 | 367 | } 368 | 369 | else 370 | 371 | { 372 | 373 | for(int i=0; i<12; ++i) 374 | 375 | { 376 | 377 | printf("%c",solve[i]); 378 | 379 | } 380 | 381 | 382 | 383 | printf("%c\n",test); 384 | 385 | } 386 | 387 | 388 | 389 | } 390 | 391 | 392 | 393 | return 0; 394 | 395 | } 396 | 397 | ``` 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | ### (2)排列组合下面的修改还是80%(心碎) 406 | 407 | 408 | 409 | ```cpp 410 | 411 | #include 412 | 413 | using namespace std; 414 | 415 | 416 | 417 | int num[10]; 418 | 419 | map mp; 420 | 421 | void init() 422 | 423 | { 424 | 425 | for(int i=0; i<10; ++i) 426 | 427 | { 428 | 429 | mp[i]='0'+i; 430 | 431 | } 432 | 433 | 434 | 435 | mp[10]='X'; 436 | 437 | } 438 | 439 | 440 | 441 | int main() 442 | 443 | { 444 | 445 | char solve[15]; 446 | 447 | init(); 448 | 449 | 450 | 451 | while( NULL!=gets(solve) ) 452 | 453 | { 454 | 455 | int tag=1; 456 | 457 | //注意扫描到9+2之前就好了 458 | 459 | for(int i=0; i<11 ; ++i) 460 | 461 | { 462 | 463 | if( '-'!=solve[i] ) 464 | 465 | { 466 | 467 | num[tag++]=solve[i]-'0'; 468 | 469 | } 470 | 471 | } 472 | 473 | 474 | 475 | int sum=0; 476 | 477 | for(int i=1; i<=9; ++i) 478 | 479 | { 480 | 481 | sum+=( i *num[i] ); 482 | 483 | 484 | 485 | } 486 | 487 | 488 | 489 | 490 | 491 | sum%=11; 492 | 493 | char test=mp[sum]; 494 | 495 | 496 | 497 | 498 | 499 | if( test==solve[12] ) 500 | 501 | { 502 | 503 | printf("Right\n"); 504 | 505 | } 506 | 507 | else 508 | 509 | { 510 | 511 | //修改的地方 512 | 513 | for(int i=0; i<12; ++i) 514 | 515 | { 516 | 517 | printf("%c",solve[i]); 518 | 519 | } 520 | 521 | 522 | 523 | //修改点1:只修改这里还不能AC 524 | 525 | // printf("%d-%d%d%d-%d%d%d%d%d-",num[1],num[2],num[3], 526 | 527 | // num[4],num[5],num[6],num[7],num[8],num[9]); 528 | 529 | 530 | 531 | //修改点2: 532 | 533 | //printf("%c\n",test); 534 | 535 | 536 | 537 | if( 10==sum ) 538 | 539 | { 540 | 541 | printf("X\n"); 542 | 543 | } 544 | 545 | else 546 | 547 | { 548 | 549 | printf("%d\n",sum); 550 | 551 | } 552 | 553 | } 554 | 555 | 556 | 557 | } 558 | 559 | 560 | 561 | return 0; 562 | 563 | } 564 | 565 | ``` 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | ## 三、最大的矩形 578 | 579 | 580 | 581 | 582 | 583 | ### 解法1(单调栈) 584 | 585 | 运行时间:15ms 586 | 587 | 似乎有2种说法 588 | 589 | [CSDN上](https://blog.csdn.net/XxxxxM1/article/details/81324228) 590 | 591 | [挑战程序设计竞赛书上] 592 | 593 | 594 | 595 | 核心都是将问题转换,然后,发现转换后的问题可以用单调栈来解决。 596 | 597 | 598 | 599 | ```cpp 600 | 601 | #include 602 | 603 | using namespace std; 604 | 605 | 606 | 607 | const int maxn=1000+5; 608 | 609 | int height[maxn]; 610 | 611 | 612 | 613 | int Left[maxn]; 614 | 615 | int Right[maxn]; 616 | 617 | 618 | 619 | 620 | 621 | //构造前n个元素的Left和Right数组 622 | 623 | void solution(int n) 624 | 625 | { 626 | 627 | stack stack_index; 628 | 629 | 630 | 631 | //Left数组 632 | 633 | for(int i=0;i=height[i])) 640 | 641 | { 642 | 643 | stack_index.pop(); 644 | 645 | } 646 | 647 | 648 | 649 | // Left[i]= (stack_index.empty()) ? 0 : stack_index.top()+1; 650 | 651 | if(stack_index.empty()) 652 | 653 | { 654 | 655 | //左闭的最左边是0 656 | 657 | Left[i]=0; 658 | 659 | } 660 | 661 | else 662 | 663 | { 664 | 665 | //因为是左闭区间 666 | 667 | Left[i]=stack_index.top()+1; 668 | 669 | } 670 | 671 | 672 | 673 | //注意是放入下表index 674 | 675 | stack_index.push(i); 676 | 677 | } 678 | 679 | 680 | 681 | 682 | 683 | while(!stack_index.empty()) 684 | 685 | { 686 | 687 | stack_index.pop(); 688 | 689 | } 690 | 691 | 692 | 693 | //Right数组,注意遍历方向 694 | 695 | for(int i=n-1;i>=0;--i) 696 | 697 | { 698 | 699 | //如果非空,并且栈中元素大于等于右边,可以更新 700 | 701 | while((!stack_index.empty())&&(height[stack_index.top()]>=height[i])) 702 | 703 | { 704 | 705 | stack_index.pop(); 706 | 707 | } 708 | 709 | 710 | 711 | // Right[i]= (stack_index.empty()) ? n : stack_index.top(); 712 | 713 | if(stack_index.empty()) 714 | 715 | { 716 | 717 | //右开的最右边是n 718 | 719 | Right[i]=n; 720 | 721 | } 722 | 723 | else 724 | 725 | { 726 | 727 | //因为是右开区间 728 | 729 | Right[i]=stack_index.top(); 730 | 731 | } 732 | 733 | 734 | 735 | //注意是放入下表index 736 | 737 | stack_index.push(i); 738 | 739 | } 740 | 741 | 742 | 743 | 744 | 745 | } 746 | 747 | 748 | 749 | 750 | 751 | int main() 752 | 753 | { 754 | 755 | int n; 756 | 757 | while(~scanf("%d",&n)) 758 | 759 | { 760 | 761 | memset(Left,0,sizeof(Left)); 762 | 763 | memset(Right,0,sizeof(Right)); 764 | 765 | 766 | 767 | for(int i=0;i 838 | 839 | using namespace std; 840 | 841 | 842 | 843 | 844 | 845 | const int maxn=1000+5; 846 | 847 | int height[maxn]; 848 | 849 | 850 | 851 | 852 | 853 | //返回区间[left,right]中最矮的 854 | 855 | int rt(int left,int right) 856 | 857 | { 858 | 859 | int num=0x3f3f3f3f; 860 | 861 | while(left<=right) 862 | 863 | { 864 | 865 | num=min(num,height[left]); 866 | 867 | ++left; 868 | 869 | } 870 | 871 | 872 | 873 | return num; 874 | 875 | } 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | int main() 884 | 885 | { 886 | 887 | 888 | 889 | int n; 890 | 891 | while(~scanf("%d",&n)) 892 | 893 | { 894 | 895 | 896 | 897 | for(int i=0;i 957 | #include 958 | using namespace std; 959 | int main() 960 | { 961 | char a[13]; 962 | int b[13]={0}; 963 | char c; 964 | for(int i=0;i<13;i++) 965 | { 966 | scanf("%c",&a[i]); 967 | if(a[i]!='-') 968 | { 969 | c=a[i]; 970 | b[i]=(int)c-48;//解决了强制类型转换,因为字符0-9对应的ASCII码为48-57 971 | } 972 | } 973 | int sum=0; 974 | int j=1; 975 | int num; 976 | for(int i=0;i<12;i++) 977 | { 978 | if(a[i]!='-') 979 | { 980 | sum=sum+b[i]*j; 981 | ++j; 982 | } 983 | } 984 | 985 | int k; 986 | k=sum%11; 987 | char cc='n'; 988 | if(k==10) 989 | { 990 | cc='X'; 991 | } 992 | 993 | if(k==(int)a[12]-48) 994 | { 995 | printf("Right"); 996 | } 997 | else if(cc==a[12]) 998 | { 999 | printf("Right");//判别为X的情况 1000 | } 1001 | else 1002 | { 1003 | for(int i=0;i<12;i++) 1004 | { 1005 | printf("%c",a[i]); 1006 | } 1007 | printf("%c",(char)(k+48));//-------------(重点) 1008 | } 1009 | 1010 | return 0; 1011 | } 1012 | ``` 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | ## 二、(3)100分 1019 | 1020 | ```cpp 1021 | #include 1022 | #include 1023 | using namespace std; 1024 | int main() 1025 | { 1026 | char a[13]; 1027 | int b[13]={0}; 1028 | char c; 1029 | for(int i=0;i<13;i++) 1030 | { 1031 | scanf("%c",&a[i]); 1032 | if(a[i]!='-') 1033 | { 1034 | c=a[i]; 1035 | b[i]=(int)c-48;//解决了强制类型转换,因为字符0-9对应的ASCII码为48-57 1036 | } 1037 | } 1038 | int sum=0; 1039 | int j=1; 1040 | int num; 1041 | for(int i=0;i<12;i++) 1042 | { 1043 | if(a[i]!='-') 1044 | { 1045 | sum=sum+b[i]*j; 1046 | ++j; 1047 | } 1048 | } 1049 | 1050 | int k; 1051 | k=sum%11; 1052 | char cc='n'; 1053 | if(k==10) 1054 | { 1055 | cc='X'; 1056 | } 1057 | 1058 | if(k==(int)a[12]-48) 1059 | { 1060 | printf("Right"); 1061 | } 1062 | else if(cc==a[12]) 1063 | { 1064 | printf("Right");//判别为X的情况 1065 | } 1066 | else 1067 | { 1068 | // for(int i=0;i<12;i++) 1069 | // { 1070 | // printf("%c",a[i]); 1071 | // } 1072 | // printf("%c",(char)(k+48));//------------------------------ 1073 | for(int i=0;i<12;i++) 1074 | { 1075 | if(a[i]!='-') 1076 | { 1077 | printf("%d",b[i]); 1078 | } 1079 | else 1080 | printf("%c",a[i]); 1081 | } 1082 | 1083 | if(k==10) 1084 | { 1085 | printf("%c",cc); 1086 | } 1087 | else 1088 | printf("%d",k);//------------------------------修改部分 1089 | } 1090 | return 0; 1091 | } 1092 | ``` 1093 | 1094 | 1095 | 1096 | ```txt 1097 | 1098 | /*解题报告 1099 | 题型: 1100 | 简单模拟题(情况比第一题多,格式需要注意) 1101 | 1102 | 注意点+工具: 1103 | 1.碰到的问题是“char类型怎么变成int类型” 1104 | 2.碰到的问题是“ISBN码包括9位数字”中输出格式不对,所以不能满分!! 1105 | 3.如果余数为10,则识别码为大写字母X,该情况的讨论不全,也导致不是满分! 1106 | 1107 | 1108 | 思路: 1109 | 1)本方法为直接模拟 1110 | 1111 | */ 1112 | 1113 | ``` 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | -------------------------------------------------------------------------------- /02.CCF_CSP/2013年/目录.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/02.CCF_CSP/2013年/目录.md -------------------------------------------------------------------------------- /02.CCF_CSP/2014年/2014年03月.md: -------------------------------------------------------------------------------- 1 | # 2014年03月 2 | 3 | ## 一、相反数 4 | 5 | ```cp 6 | #include 7 | using namespace std; 8 | 9 | static const int maxn=1000+5; 10 | int solve[2][maxn]; 11 | 12 | int main() 13 | { 14 | int n,temp; 15 | while( ~scanf("%d",&n) ) 16 | { 17 | memset( solve, sizeof( solve ), 0); 18 | 19 | for(int i=0; i 9 | #include 10 | #include 11 | 12 | using namespace std; 13 | int main() 14 | { 15 | int n; 16 | scanf("%d",&n); 17 | int aa[n]; 18 | for(int i=0;i 7 | #include 8 | using namespace std; 9 | int main() 10 | { 11 | int n; 12 | int test[1000]={0}; 13 | scanf("%d",&n); 14 | int aa[n]; 15 | int bb[n]; 16 | for(int i=0;i 9 | using namespace std; 10 | 11 | static const int maxn=1000+5; 12 | int solve[maxn][maxn]; 13 | 14 | 15 | int main() 16 | { 17 | // cout<0; --i ) 31 | { 32 | for(int j=1; j<=n; ++j) 33 | { 34 | if( j!=n ) 35 | { 36 | printf("%d ",solve[j][i]); 37 | } 38 | else 39 | { 40 | printf("%d\n",solve[j][i]); 41 | } 42 | } 43 | 44 | } 45 | 46 | } 47 | 48 | 49 | return 0; 50 | } 51 | ``` 52 | 53 | 54 | 55 | ## 二、数字排序 56 | 57 | ```cpp 58 | #include 59 | using namespace std; 60 | 61 | bool cmp( pair a, pair b) 62 | { 63 | if( a.first == b.first ) 64 | { 65 | return a.secondb.first; 70 | } 71 | } 72 | 73 | int main() 74 | { 75 | int n,temp; 76 | map mp; 77 | 78 | while( ~scanf("%d",&n) ) 79 | { 80 | for(int i=0; i > solve; 87 | 88 | int len=0; 89 | map::iterator it=mp.begin(); 90 | while( it!=mp.end( ) ) 91 | { 92 | 93 | pair num; 94 | num.first=it->second; 95 | num.second=it->first; 96 | solve.push_back( num ); 97 | ++it; 98 | ++len; 99 | } 100 | 101 | sort(solve.begin(), solve.end(), cmp); 102 | 103 | for(int i=0; i 7 | #include 8 | 9 | using namespace std; 10 | int main() 11 | { 12 | int n; 13 | scanf("%d",&n); 14 | int aa[n]; 15 | for(int i=0;i 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | int main() 14 | { 15 | string str; 16 | cin>>str; 17 | int sum=0; 18 | 19 | for(string::iterator it=str.begin();it!=str.end();it++) 20 | { 21 | sum=sum+(*it-'0'); 22 | } 23 | printf("%d",sum); 24 | 25 | return 0; 26 | } 27 | 28 | //虽然题目中说那个是输入一个数字,但是我用cin输入到string类型中,也OK 29 | //是100分 30 | 31 | ``` 32 | 33 | ```cpp 34 | #include 35 | #include 36 | using namespace std; 37 | int main() 38 | { 39 | string str; 40 | cin>>str; 41 | int sum=0; 42 | for(int i=0;i 58 | int main() 59 | { 60 | int n,m; 61 | scanf("%d%d",&n,&m); 62 | int aa[n][m]={};//修改处1把{0}改为了{} 63 | 64 | int test[n][m]={};// 修改处2把{0}改为了{} 65 | 66 | for(int i=0;i 155 | #include 156 | #include 157 | using namespace std; 158 | int main() 159 | { 160 | int n=10,m=10; 161 | char aa[n][m]; 162 | 163 | for(int i=0;i 7 | #include 8 | using namespace std; 9 | int main() 10 | { 11 | int n,sum=0; 12 | scanf("%d",&n); 13 | int a[n]; 14 | for(int i=0;ia[i]&&a[i]a[i+1]) 25 | { 26 | sum++; 27 | } 28 | } 29 | printf("%d",sum); 30 | return 0; 31 | } 32 | 33 | ``` 34 | 35 | -------------------------------------------------------------------------------- /02.CCF_CSP/2016年/2016年09月.md: -------------------------------------------------------------------------------- 1 | # 2016年09月 2 | 3 | ## 一、最大波动 4 | 5 | ```cpp 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | int main() 11 | { 12 | int n; 13 | scanf("%d",&n); 14 | int aa[n]; 15 | for(int i=0;imax) 25 | { 26 | max=abs(aa[i+1]-aa[i]); 27 | } 28 | } 29 | printf("%d",max); 30 | 31 | return 0; 32 | } 33 | 34 | ``` 35 | 36 | -------------------------------------------------------------------------------- /02.CCF_CSP/2016年/2016年12月.md: -------------------------------------------------------------------------------- 1 | # 2016年12月 2 | 3 | ## 一、中间数 4 | 5 | 6 | 7 | ### (1)80分和100分 8 | 9 | ```cpp 10 | #include 11 | using namespace std; 12 | 13 | static const int maxn=1000+5; 14 | 15 | //前缀和数组,0放元素,1放个数,2放前缀和,3放后缀和 16 | int solve[maxn][4]; 17 | 18 | 19 | int main() 20 | { 21 | int n,temp; 22 | map mp; 23 | 24 | while( ~scanf("%d",&n) ) 25 | { 26 | mp.clear();//一定要记得清理,否则多组输入输出会出错 27 | 28 | for(int i=0; i::iterator it=mp.begin(); 37 | while( it!=mp.end() ) 38 | { 39 | solve[len][0]=it->first; 40 | solve[len][1]=it->second; 41 | ++len; 42 | ++it; 43 | } 44 | 45 | solve[0][2]=solve[0][1]; 46 | for(int i=1; i=0; --i) 53 | { 54 | solve[i][3]=solve[i+1][3]+solve[i][1]; 55 | } 56 | 57 | int tag=-1; 58 | for(int i=1; i 81 | using namespace std; 82 | 83 | static const int maxn=1000+5; 84 | 85 | //前缀和数组,0放元素,1放个数,2放前缀和,3放后缀和 86 | int solve[maxn][4]; 87 | 88 | 89 | int main() 90 | { 91 | int n,temp; 92 | 93 | 94 | while( ~scanf("%d",&n) ) 95 | { 96 | map mp; 97 | // mp.clear();//一定要记得清理,否则多组输入输出会出错 98 | 99 | for(int i=0; i::iterator it=mp.begin(); 108 | while( it!=mp.end() ) 109 | { 110 | solve[len][0]=it->first; 111 | solve[len][1]=it->second; 112 | ++len; 113 | ++it; 114 | } 115 | 116 | solve[0][2]=solve[0][1]; 117 | for(int i=1; i=0; --i) 124 | { 125 | solve[i][3]=solve[i+1][3]+solve[i][1]; 126 | } 127 | 128 | int tag=-1; 129 | for(int i=1; i 158 | using namespace std; 159 | int main() 160 | { 161 | int n; 162 | 163 | while( ~scanf("%d",&n) ) 164 | { 165 | vector solve(n); 166 | for(int i=0;i::iterator,vector::iterator> it; 178 | it=equal_range( solve.begin(), solve.end(), solve[n/2]); 179 | 180 | if( it.first-solve.begin()==solve.end()-it.second ) 181 | { 182 | printf("%d\n",solve[n/2]); 183 | } 184 | else 185 | { 186 | printf("-1\n"); 187 | } 188 | 189 | } 190 | 191 | return 0; 192 | } 193 | ``` 194 | 195 | 196 | 197 | ## 二、工资计算 -------------------------------------------------------------------------------- /02.CCF_CSP/2016年/目录.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/02.CCF_CSP/2016年/目录.md -------------------------------------------------------------------------------- /02.CCF_CSP/2017年/2017年03月.md: -------------------------------------------------------------------------------- 1 | # 2017年03月 2 | 3 | ## 一、分蛋糕 4 | 5 | ```cpp 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | int main() 11 | { 12 | int n,k; 13 | scanf("%d%d",&n,&k); 14 | int a[n]; 15 | for(int i=0;i=k) 29 | { 30 | human++; 31 | sum=0; 32 | } 33 | } 34 | printf("%d",human); 35 | return 0; 36 | } 37 | 38 | ``` 39 | 40 | ## 二、学生排队 41 | 42 | ```cpp 43 | #include 44 | 45 | int main() 46 | { 47 | int n,m; 48 | scanf("%d",&n); 49 | scanf("%d",&m); 50 | int aa[n+1]={0}; 51 | for(int ii=1;ii<=n;ii++) 52 | { 53 | aa[ii]=ii; 54 | } 55 | int a,b,ii,jj; 56 | 57 | 58 | for(int k=0;k0) 63 | { 64 | for(int i=1;i<(n+1);i++) 65 | { 66 | if(aa[i]==a) 67 | { 68 | ii=i; 69 | break; 70 | } 71 | 72 | } 73 | int s=a; 74 | for(int num=ii;num>(ii-b);num--) 75 | { 76 | aa[num]=aa[num-1]; 77 | } 78 | aa[ii-b]=s; 79 | 80 | } 81 | else if(b<0) 82 | { 83 | for(int j=1;j<(n+1);j++) 84 | { 85 | if(aa[j]==a) 86 | { 87 | jj=j; 88 | break; 89 | } 90 | 91 | } 92 | int ss=a; 93 | for(int num=jj;num<(jj-b);num++) 94 | { 95 | aa[num]=aa[num+1]; 96 | } 97 | aa[jj-b]=ss; 98 | 99 | } 100 | 101 | } 102 | 103 | for(int d=1;d<(n+1);d++) 104 | { 105 | if(d!=n) 106 | printf("%d ",aa[d]); 107 | else 108 | printf("%d",aa[d]); 109 | } 110 | 111 | 112 | 113 | return 0; 114 | } 115 | 116 | ``` 117 | 118 | -------------------------------------------------------------------------------- /02.CCF_CSP/2017年/2017年09月.md: -------------------------------------------------------------------------------- 1 | # 2017年09月 2 | 3 | ## 一、打酱油 4 | 5 | ```cpp 6 | #include 7 | #include 8 | using namespace std; 9 | int main() 10 | { 11 | int n; 12 | scanf("%d",&n); 13 | int a=0,b=0,c=0; 14 | 15 | while(1) 16 | { 17 | for(int i=1;;i++) 18 | { 19 | if((n-50*i)<0) 20 | { 21 | a=i-1; 22 | break; 23 | } 24 | } 25 | 26 | for(int i=1;;i++) 27 | { 28 | if((n-50*a-30*i)<0) 29 | { 30 | b=i-1; 31 | break; 32 | } 33 | } 34 | 35 | for(int i=1;;i++) 36 | { 37 | if((n-50*a-30*b-10*i)<0) 38 | { 39 | c=i-1; 40 | break; 41 | } 42 | } 43 | 44 | if((50*a+30*b+10*c)==n) 45 | { 46 | break; 47 | } 48 | } 49 | printf("%d",(7*a+4*b+c)); 50 | return 0; 51 | } 52 | 53 | ``` 54 | 55 | -------------------------------------------------------------------------------- /02.CCF_CSP/2017年/2017年12月.md: -------------------------------------------------------------------------------- 1 | # 2017年12月 2 | 3 | 4 | 5 | 6 | 7 | ## 一、最小差值 8 | 9 | 考点:模拟 10 | 11 | 下面测试显示,判卷系统底层是`Linux`,可以用万能头文件。 12 | 13 | 14 | ```cpp 15 | #include 16 | using namespace std; 17 | 18 | int test[1005]; 19 | 20 | int main() 21 | { 22 | int n; 23 | while(~scanf("%d",&n)) 24 | { 25 | for(int i=0;i 57 | using namespace std; 58 | 59 | int main() 60 | { 61 | 62 | int n,k; 63 | while( ~scanf("%d%d",&n,&k) ) 64 | { 65 | queue solve; 66 | for(int i=1; i<=n; ++i) 67 | { 68 | solve.push(i); 69 | } 70 | 71 | //模拟循环队列 72 | int tag=1; 73 | while( 1!=solve.size() ) 74 | { 75 | int temp=solve.front(); 76 | solve.pop(); 77 | 78 | if( !(0==tag%k || k==tag%10) ) 79 | { 80 | solve.push( temp ); 81 | ++tag; 82 | } 83 | else 84 | { 85 | ++tag; 86 | } 87 | 88 | } 89 | 90 | printf("%d\n",solve.front() ); 91 | } 92 | 93 | return 0; 94 | } 95 | ``` 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /02.CCF_CSP/2017年/目录.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/02.CCF_CSP/2017年/目录.md -------------------------------------------------------------------------------- /02.CCF_CSP/2018年/2018年03月.md: -------------------------------------------------------------------------------- 1 | # 2018年03月 2 | 3 | ## 一、跳一跳 4 | 5 | ```cpp 6 | #include 7 | using namespace std; 8 | 9 | 10 | int solve[35]; 11 | int len=0; 12 | int sum=0; 13 | 14 | //除去第一次之外的选择返回 15 | int select(int prev, int selectNum ) 16 | { 17 | if( 1==selectNum ) 18 | { 19 | return 1; 20 | } 21 | else 22 | { 23 | if( 1==prev ) 24 | { 25 | return 2; 26 | } 27 | else 28 | { 29 | return prev+2; 30 | } 31 | } 32 | } 33 | 34 | 35 | int main() 36 | { 37 | 38 | int temp; 39 | len=0; 40 | 41 | while( ~scanf("%d",&temp) ) 42 | { 43 | if( 0==temp ) 44 | { 45 | break; 46 | } 47 | else 48 | { 49 | solve[len++]=temp; 50 | } 51 | } 52 | 53 | 54 | sum=0; 55 | int prev=1; 56 | for(int i=0; i 93 | using namespace std; 94 | 95 | static const int maxn=105; 96 | int solve[maxn]; 97 | int num,L,T; 98 | int n,Len,Time; 99 | 100 | int main() 101 | { 102 | while( ~scanf("%d%d%d",&num,&L,&T) ) 103 | { 104 | for(int i=0; i 7 | #include 8 | using namespace std; 9 | int main() 10 | { 11 | int n; 12 | scanf("%d",&n); 13 | int a[n]; 14 | for(int i=0;i 45 | #include 46 | using namespace std; 47 | int main() 48 | { 49 | int n; 50 | scanf("%d",&n); 51 | int a[10001]={0}; 52 | int b[10001]={0}; 53 | int num1=0,num2=0; 54 | for(int i=0;i 13 | using namespace std; 14 | 15 | int n; 16 | //代码100000+5 17 | static const int maxn=1e5+5; 18 | int solve[maxn]; 19 | 20 | int main() 21 | { 22 | while( ~scanf("%d",&n) ) 23 | { 24 | if( n<=0 ) 25 | { 26 | break; 27 | } 28 | 29 | for(int i=0; i 82 | using namespace std; 83 | 84 | char solution[15]; 85 | 86 | int main() 87 | { 88 | //优先级设置 89 | map mp; 90 | mp['+']=1; 91 | mp['-']=2; 92 | mp['x']=3; 93 | mp['/']=4; 94 | 95 | 96 | int n; 97 | while(~scanf("%d",&n)) 98 | { 99 | for(int i=0;i num; 103 | num.push_back(solution[0]-'0'); 104 | 105 | queue myOperator; 106 | 107 | //搞定优先级3-4 108 | for(int j=1;j<=5;j+=2) 109 | { 110 | if(mp[solution[j]]>2) 111 | { 112 | int a=num[num.size()-1]; 113 | num.pop_back(); 114 | 115 | int b=solution[j+1]-'0'; 116 | if('x'==solution[j]) 117 | { 118 | num.push_back(a*b); 119 | } 120 | else 121 | { 122 | num.push_back(a/b); 123 | } 124 | 125 | } 126 | else 127 | { 128 | num.push_back(solution[j+1]-'0'); 129 | myOperator.push(solution[j]); 130 | } 131 | 132 | } 133 | 134 | 135 | //搞定优先级1-2 136 | while(!myOperator.empty()) 137 | { 138 | if('+'==myOperator.front()) 139 | { 140 | int a=num[0]; 141 | int b=num[1]; 142 | num.pop_front(); 143 | num.pop_front(); 144 | num.push_front(a+b); 145 | } 146 | else 147 | { 148 | int a=num[0]; 149 | int b=num[1]; 150 | num.pop_front(); 151 | num.pop_front(); 152 | num.push_front(a-b); 153 | } 154 | 155 | myOperator.pop(); 156 | } 157 | 158 | 159 | if(24==num[0]) 160 | { 161 | printf("Yes\n"); 162 | } 163 | else 164 | { 165 | printf("No\n"); 166 | } 167 | 168 | //还有个坑,记得把num清空 169 | num.pop_back(); 170 | } 171 | } 172 | 173 | 174 | 175 | return 0; 176 | } 177 | ``` 178 | 179 | 180 | 181 | ## 三、损坏的RAID5 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /02.CCF_CSP/2019年/2019年09月.md: -------------------------------------------------------------------------------- 1 | # 2019年09月 2 | 3 | ## 一、小明种苹果 4 | 5 | 6 | 7 | ### (1)子任务骗分方式20 8 | 9 | 只是测试一下 10 | 11 | - 题目中有10个测试点,我纯粹为了测试,只完成了子任务1和2,就得分20 12 | 13 | ```cpp 14 | #include 15 | using namespace std; 16 | 17 | 18 | int n,m; 19 | 20 | int main() 21 | { 22 | 23 | while( ~scanf("%d%d",&n,&m) ) 24 | { 25 | if( 1==n && 1==m ) 26 | { 27 | int a,b; 28 | scanf("%d%d",&a,&b); 29 | printf("%d %d %d\n",a+b,1,-1*b); 30 | } 31 | } 32 | 33 | return 0; 34 | } 35 | ``` 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | ### (2)真正的做题 44 | 45 | ```cpp 46 | #include 47 | using namespace std; 48 | 49 | static const int maxn=1000+5; 50 | int n,m,temp; 51 | int solve[maxn][2]; 52 | 53 | int main() 54 | { 55 | 56 | while( ~scanf("%d%d",&n,&m) ) 57 | { 58 | int del=0x3f3f3f;//最小梳果数量 59 | int sumHave=0;//原先有的果子数量 60 | int sumDel=0;//总的梳果数量 61 | 62 | // 几次写错成这样了,memset( solve, sizeof(solve), 0); 63 | memset( solve, 0, sizeof( solve ) ); 64 | 65 | for(int i=0; i 11 | using namespace std; 12 | 13 | //用程序测试出来的,1500比较OK,主要是怕打表的时候超时 14 | static const int maxn=1500+5; 15 | bool test[maxn]={0}; 16 | 17 | //是否含有7 18 | bool num2char(int num) 19 | { 20 | char demo[10]; 21 | sprintf(demo,"%d",num); 22 | int len=strlen(demo); 23 | 24 | for(int i=0; i 153 | using namespace std; 154 | 155 | static const int maxn=1000+5; 156 | 157 | struct node 158 | { 159 | int x,y; 160 | int around;//四周垃圾个数 161 | int fraction;//分数 162 | 163 | node() 164 | { 165 | around=0; 166 | fraction=0; 167 | }; 168 | 169 | }solve[maxn]; 170 | 171 | 172 | int main() 173 | { 174 | int n,a,b; 175 | while( ~scanf("%d",&n) ) 176 | { 177 | 178 | for(int i=0; i 9 | using namespace std; 10 | 11 | struct node 12 | { 13 | int x; 14 | int y; 15 | node(int _x, int _y):x( _x),y( _y) 16 | { 17 | } ; 18 | }; 19 | 20 | const int maxn=1000+5; 21 | int A[maxn]; 22 | int B[maxn]; 23 | int lenA=0,lenB=0; 24 | vector aa,bb; 25 | 26 | //大于0则1,小于则-1 27 | int solve(int a, int b, int c) 28 | { 29 | for(int i=0; i0 ) 32 | { 33 | A[i]=1; 34 | } 35 | else 36 | { 37 | A[i]=-1; 38 | } 39 | } 40 | 41 | for(int i=0; i0 ) 44 | { 45 | B[i]=1; 46 | } 47 | else 48 | { 49 | B[i]=-1; 50 | } 51 | } 52 | 53 | int maybe=A[0]; 54 | for(int i=1; i 155 | using namespace std; 156 | 157 | int n,a,b; 158 | queue > AA,BB; 159 | 160 | int main() 161 | { 162 | while( ~scanf("%d%d%d",&n,&a,&b) ) 163 | { 164 | while( !AA.empty() ) 165 | { 166 | AA.pop(); 167 | } 168 | while( !BB.empty() ) 169 | { 170 | BB.pop(); 171 | } 172 | 173 | for(int i=0; i temp; 176 | scanf("%d%d",&temp.first, &temp.second); 177 | AA.push( temp ); 178 | } 179 | 180 | for(int i=0; i temp; 183 | scanf("%d%d",&temp.first, &temp.second); 184 | BB.push( temp ); 185 | } 186 | 187 | long long val=0; 188 | while( !AA.empty() && !BB.empty() ) 189 | { 190 | // cout<<"OK"< 13 | using namespace std; 14 | 15 | int thought=0;//经过 16 | int stay=0;//逗留 17 | int n,k,t; 18 | static const int maxn=1e3+5; 19 | int xx[maxn]; 20 | int yy[maxn]; 21 | 22 | int XL,YD; 23 | int XR,YU; 24 | bool test(int x,int y) 25 | { 26 | 27 | if( x>=XL && x<=XR ) 28 | { 29 | if( y>=YD && y<=YU ) 30 | { 31 | return true; 32 | } 33 | } 34 | 35 | return false; 36 | } 37 | 38 | 39 | int main() 40 | { 41 | while( ~scanf("%d%d%d%d%d%d%d",&n,&k,&t,&XL,&YD,&XR,&YU) ) 42 | { 43 | thought=0; 44 | stay=0; 45 | 46 | while( n-- ) 47 | { 48 | for(int i=0; i=k ) 73 | { 74 | ++stay; 75 | } 76 | } 77 | 78 | } 79 | 80 | printf("%d\n%d\n", thought, stay); 81 | } 82 | 83 | 84 | return 0; 85 | } 86 | ``` 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | ## 五、密信与计数 95 | 96 | 97 | 98 | ### (1)面向样例编程——这种骗分方式不行 99 | 100 | 虽然是面向样例编程,并且考虑了超时,但是似乎测试数据中没有这2个样例,所以是0分 101 | 102 | ```cpp 103 | #include 104 | using namespace std; 105 | 106 | int a,b; 107 | 108 | int main() 109 | { 110 | while( ~scanf("%d%d",&a,&b) ) 111 | { 112 | if( 2==a ) 113 | { 114 | printf("1\n2\n3\n5\n"); 115 | } 116 | 117 | if( 1==a ) 118 | { 119 | printf("4\n"); 120 | printf("\n"); 121 | printf("15\n"); 122 | printf("62\n"); 123 | printf("254\n"); 124 | printf("1037\n"); 125 | printf("4238\n"); 126 | printf("17318\n"); 127 | printf("70762\n"); 128 | printf("289147\n"); 129 | printf("1181515\n"); 130 | printf("4827896\n"); 131 | printf("19727703\n"); 132 | printf("80611180\n"); 133 | printf("329392745\n"); 134 | printf("347717570\n"); 135 | printf("508636782\n"); 136 | printf("512101020\n"); 137 | printf("990699955\n"); 138 | printf("897183687\n"); 139 | printf("992683554\n"); 140 | printf("367164478\n"); 141 | printf("441771655\n"); 142 | printf("282208579\n"); 143 | printf("707622895\n"); 144 | printf("680435638\n"); 145 | printf("349679885\n"); 146 | printf("49272719\n"); 147 | printf("821317456\n"); 148 | printf("174000209\n"); 149 | printf("371253693\n"); 150 | } 151 | 152 | break;//不加这个,由于后面还有暑假,会导致运行超时 153 | } 154 | 155 | return 0; 156 | } 157 | ``` 158 | 159 | ### (2)正确的骗分方式——选择小的数据范围写代码 -------------------------------------------------------------------------------- /02.CCF_CSP/2020年/2020年12月CSP考场环境.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 2020年12月份CSP总结 4 | 5 | 6 | 7 | 8 | 9 | ## 一、测试环境 10 | 11 | 1、今年的测试环境有测试结果,比如50,60分,100分 12 | 13 | 2、此外,每个题目似乎是10组样例 14 | 15 | 16 | 17 | 很显然,是清华“酒井算协”的OJ系统,评测一个字,慢。。 18 | 19 | 虽然没大影响啥,毕竟可以先做其他的题目啊。等个4-5分钟(官方诚不欺我,果然至少要等这么久才判你的题目) 20 | 21 | 22 | 23 | 可选环境: 24 | 25 | 其他,比如g++98那样的版本,我就没记载。 26 | 27 | | 名称 | 编译器 | 额外 | 代码长度 | 28 | | -------------- | ------- | --------------------- | -------- | 29 | | g++ with std11 | g++ | -O2-std=c++11-DONLINE | 65536B | 30 | | gcc with std11 | gcc | -O2-std=c11 | 65536B | 31 | | java | javac | | 65536B | 32 | | python | python | | 65536B | 33 | | python3 | python3 | | 65536B | 34 | 35 | 36 | 37 | ## 二、现场机房配置 38 | 39 | 额,说好的VScode啥的呢,怎么还是DevC++啥的。。。 40 | 41 | 然后,我一如既往的给DevC++配置上`-std=c++11` 42 | 43 | 44 | 45 | ## 三、考试经历 46 | 47 | 1、6分钟之内搞定第1个水题 48 | 49 | 2、40分钟之内搞定前2题 50 | 51 | 3、看到第3题,umm。心态挺好的(忍住砸电脑),但实在没耐心看题目下去 52 | 53 | 第3题,看了一会,尝试三板斧: 54 | 55 | (1)针对题目,一步步,设计出“数据结构”,进行工程上模块的划分 56 | 57 | (2)看需不需要用“正则表达式” 58 | 59 | (3)哦,第3板斧,我还没想出来。 60 | 61 | 理论上来讲,(1)号方法很适合这次的题目,应该是可以解决这个问题的。但实在没耐心 62 | 63 | 4、第4题,考图论。 64 | 65 | 5、第5题,不记得了 66 | 67 | 68 | 69 | 骗分30分钟左右 70 | 71 | 我用最拙劣的3种方法骗分: 72 | 73 | 1、直接看着样例编程——很显然,官方测试样例专门跳过了这2个,为的就是避免我这种没技术含量的骗分 74 | 75 | 2、比如,直接输出F这样的,很显然,没有全F的啥的 76 | 77 | 3、rand随机出来,选择T还是F,ummm,这个太靠运气了。很显然,这没办法,脚指头用概率论算一算对的概率,那还是当买个彩票吧。 78 | 79 | 80 | 81 | 考试一个小时多就开溜了。 82 | 83 | PS: 84 | 85 | 考试前1个小时之后才允许开溜。 86 | 87 | 考试后半个小时,不允许任何人离场。 88 | 89 | 然后,上厕所,每个考场,只能放一个出去,要上厕所的小伙伴,早点“预约” 90 | 91 | 92 | 93 | ## 四、总结 94 | 95 | 一顿操作“猛如虎”的把前2个AC掉,但有用嘛。(狗头.jpg) 96 | 97 | 看到第3题,还是没耐心看题,看来平时还是得训练训练。 98 | 99 | 100 | 101 | 吐槽:CSP考试这么贵,主要考完还纸质版的成绩单都没有,吐槽吐槽,好在蹭着本校“信科院”的团队报名码报名才打折 102 | 103 | 披着“信科院”的身份考CSP的闲杂人等(我),瑟瑟发抖(哦,是冷得发抖。。这天,长沙下雪砂了) 104 | 105 | 106 | 107 | 108 | 109 | 总的来说,2个训练点: 110 | 111 | 1、强化第3题,自己的3板斧,锻炼耐心 112 | 113 | 2、强化图论的题目 114 | 115 | 3、无论以后会不会再考这个考试,这个考试的题目,有的还是有“工程”意义的。 116 | 117 | 可以用来学习! 118 | 119 | 120 | 121 | 122 | 123 | 各个题目的3板斧 124 | 125 | 1、暴力,模拟 126 | 127 | 2、**排序**,简单思维(甚至,简单到可以暴力),暴力 128 | 129 | 3、设计数据结构,正则表达式 130 | 131 | 4、一般是图论 132 | 133 | 5、未知。未知 134 | 135 | -------------------------------------------------------------------------------- /02.CCF_CSP/2020年/目录.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/02.CCF_CSP/2020年/目录.md -------------------------------------------------------------------------------- /02.CCF_CSP/2021年/2021年04月.md: -------------------------------------------------------------------------------- 1 | # 2021年04月CSP 2 | 3 | ## 一、灰度直方图 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ## 二、邻域均值 12 | 13 | -------------------------------------------------------------------------------- /02.CCF_CSP/2021年/2021年09月.md: -------------------------------------------------------------------------------- 1 | # 2021年09月CSP 2 | 3 | ## 一、数组推导 4 | 5 | - 考点:简单的找规律 6 | 7 | ```cpp 8 | #include 9 | using namespace std; 10 | int sumMax = 0; 11 | int sumMin = 0; 12 | int n; 13 | vector B; 14 | 15 | void solve() 16 | { 17 | map mp; 18 | for (auto val : B) 19 | { 20 | if (mp[val]) 21 | { 22 | // sumMin+=0; 23 | } 24 | else 25 | { 26 | mp[val] = true; 27 | sumMin += val; 28 | } 29 | } 30 | } 31 | 32 | int main() 33 | { 34 | while (~scanf("%d", &n)) 35 | { 36 | sumMax = 0; 37 | sumMin = 0; 38 | B.clear(); 39 | B.resize(n); 40 | 41 | for (int i = 0; i < n; ++i) 42 | { 43 | scanf("%d", &B[i]); 44 | sumMax += B[i]; 45 | } 46 | solve(); 47 | 48 | printf("%d\n%d\n", sumMax, sumMin); 49 | } 50 | 51 | return 0; 52 | } 53 | ``` 54 | 55 | 56 | 57 | 58 | 59 | ## 二、非零段划分 60 | 61 | 62 | -------------------------------------------------------------------------------- /02.CCF_CSP/2021年/2021年12月.md: -------------------------------------------------------------------------------- 1 | # 2021年12月CSP 2 | 3 | ## 一、序列查询 4 | 5 | - 考点: 6 | 7 | ```cpp 8 | #include 9 | using namespace std; 10 | 11 | map mp; 12 | int n,N; 13 | long long func(int arr[]) 14 | { 15 | long long ret=0; 16 | int Left=0; 17 | int Right=1; 18 | while( Right<=n ) 19 | { 20 | int Len= arr[Right] - arr[Left]; 21 | int val= Left; 22 | ret+=(Len*val); 23 | 24 | ++Left; 25 | ++Right; 26 | } 27 | int Len= N-arr[n]; 28 | int val= n; 29 | ret+=(Len*val); 30 | return ret; 31 | } 32 | 33 | 34 | int main() 35 | { 36 | 37 | while( ~scanf("%d %d", &n, &N) ) 38 | { 39 | mp.clear(); 40 | int arr[n+1]; 41 | arr[0]=0; 42 | for(int i=1; i<=n; ++i) 43 | { 44 | scanf("%d", &arr[i]); 45 | mp[ arr[i] ]=true; 46 | } 47 | long long sum = func( arr ); 48 | printf("%lld\n",sum); 49 | } 50 | return 0; 51 | } 52 | ``` 53 | 54 | 55 | 56 | 57 | 58 | ## 二、序列查询新解 59 | 60 | - 没想到,这题和上提有关联,早知道就把上一题的也写成下面这样的node 61 | 62 | ```cpp 63 | #include 64 | using namespace std; 65 | 66 | map mp; // map num2index 67 | int n, N; 68 | int r; 69 | long long sum = 0; 70 | struct node 71 | { 72 | int Left; 73 | int Right; 74 | int Fnum; 75 | node(int L, int R, int Fn) : Left(L), Right(R), Fnum(Fn) {} 76 | }; 77 | vector help; 78 | void init() 79 | { 80 | sum = 0; 81 | mp.clear(); 82 | help.clear(); 83 | r = N / (n + 1); 84 | } 85 | 86 | void solve() 87 | { 88 | for (auto cur : help) 89 | { 90 | int Fper = mp[cur.Fnum]; //单个数字的F(x)值 91 | int Gleft = cur.Left / r; 92 | int Gright = cur.Right / r; 93 | 94 | if (Gleft == Gright) 95 | { 96 | long long val = abs(Fper - Gleft) * (cur.Right - cur.Left); 97 | sum += val; 98 | } 99 | else 100 | { 101 | // Gleft的遍历递增=================核心============== 102 | int Left = cur.Left; 103 | ++Gleft; 104 | while (Gleft <= Gright) 105 | { 106 | int Right = Gleft * r; 107 | long long val = abs(Fper - (Gleft - 1)) * (Right - Left); 108 | sum += val; 109 | Left = Right; 110 | ++Gleft; 111 | } 112 | if (Left < cur.Right) 113 | { 114 | long long val = abs(Fper - (Gleft - 1)) * (cur.Right - Left); 115 | sum += val; 116 | } 117 | // ===============核心遍历========================== 118 | } 119 | } 120 | } 121 | 122 | int main() 123 | { 124 | 125 | while (~scanf("%d %d", &n, &N)) 126 | { 127 | init(); 128 | 129 | int cur = 0; 130 | mp[0] = cur++; 131 | 132 | int Left = 0; 133 | int Right; 134 | for (int i = 0; i < n; ++i) 135 | { 136 | scanf("%d", &Right); 137 | mp[Right] = cur++; 138 | help.push_back(node(Left, Right, Left)); 139 | Left = Right; 140 | } 141 | 142 | // tips 143 | Right = N; 144 | help.push_back(node(Left, Right, Left)); 145 | 146 | solve(); 147 | printf("%lld\n", sum); 148 | } 149 | return 0; 150 | } 151 | 152 | ``` 153 | 154 | 下面是**踩坑展示** 155 | 156 | ### 2.1.暴力70% 157 | 158 | - 超时 159 | - 略 160 | 161 | ### 2.2.只按照G(x)分段,然后加和,思路错误,可能出现抵消0% 162 | 163 | - 正确解法是分2次 164 | - 1、按照F(x)分段 165 | - 2、然后按照G(x)分段 166 | 167 | ```cpp 168 | #include 169 | using namespace std; 170 | 171 | int n, N; 172 | //================ 173 | long long sum = 0; 174 | int G(int val) 175 | { 176 | int r = N / (n + 1); 177 | return val / r; 178 | } 179 | 180 | long long sumGfunc(int Left, int Right) 181 | { 182 | long long ret = 0; 183 | while (Left < Right) 184 | { 185 | ret += G(Left); 186 | ++Left; 187 | } 188 | return ret; 189 | } 190 | 191 | //================ 192 | 193 | void func(int arr[]) 194 | { 195 | long long ret = 0; 196 | int Left = 0; 197 | int Right = 1; 198 | while (Right <= n) 199 | { 200 | int Len = arr[Right] - arr[Left]; 201 | int val = Left; 202 | 203 | int temp = ret; //================= 204 | ret += (Len * val); 205 | 206 | sum += abs((ret - temp) - sumGfunc(arr[Left], arr[Right])); //========= 207 | 208 | cout << "sum-----f=" << (ret - temp) << "sum----G" << sumGfunc(arr[Left], arr[Right]) << endl; 209 | ++Left; 210 | ++Right; 211 | } 212 | 213 | int temp = ret; //================= 214 | int Len = N - arr[n]; 215 | int val = n; 216 | ret += (Len * val); 217 | sum += abs((ret - temp) - sumGfunc(arr[n], N)); //========= 218 | cout << "sum-----f=" << (ret - temp) << "sum----G" << sumGfunc(arr[n], N) << endl; 219 | 220 | // return ret; 221 | } 222 | 223 | int main() 224 | { 225 | 226 | while (~scanf("%d %d", &n, &N)) 227 | { 228 | int arr[n + 1]; 229 | arr[0] = 0; 230 | for (int i = 1; i <= n; ++i) 231 | { 232 | scanf("%d", &arr[i]); 233 | } 234 | sum = 0; 235 | func(arr); 236 | printf("%lld\n", sum); 237 | } 238 | return 0; 239 | } 240 | ``` 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | -------------------------------------------------------------------------------- /02.CCF_CSP/2021年/目录.md: -------------------------------------------------------------------------------- 1 | ## 2021年 -------------------------------------------------------------------------------- /02.CCF_CSP/CSP应试策略.md: -------------------------------------------------------------------------------- 1 |
CSP考试策略
2 | 3 | 4 | 5 | #### 零、总纲: 6 | 7 | 明确题型,合理安排 8 | 9 | 考试时长:4个小时 10 | 11 | - 有人说:csp上拿一个将近400分甚至高于400分的分数或者pat上拿一个90+的分数,是不需要什么编程天赋的,任何一个普通人只要付出足够的努力都是可以做到的。它和数学差不多,都需要大量重复的不厌其烦的练习练习再练习,没有什么捷径,只要肯付出沉下心来去做,一两个月的时间我觉得是足够让一个在数据结构和算法上基础一般的人脱胎换骨的 12 | 13 | 14 | 15 | #### 一、简单题(第1-2题) 16 | 17 | 1、能用“暴力”,不用打表 18 | 19 | 2、能用“打表“,不用数据结构 20 | 21 | 3、能用栈和队列,不用更复杂数据结构 22 | 23 | 24 | 25 | - 第1和2题,不要想得太复杂,一般难题会用较小的数据范围减低难度,可以用暴力 26 | - 第1和2题,主要自己要控制好“边界数据”的拿捏,能拿到分的,绝对不能丢分!!! 27 | 28 | 29 | 30 | #### 二、CCF:第3题 31 | 32 | 33 | 34 | #### CCF:第4题套路 35 | 36 | - 4.题图论。 37 | 38 | 思路: 39 | 40 | (1)审题,理清题意,选好存储结构,一般图论题用多维vector数组配合结构体存储。 41 | 42 | (2)想清楚题目的考点,一般的考点有: 43 | 44 | 最小生成树、迪杰斯特拉算符,并查集,DFS,BFS暴力搜图等。理清考点后,才比较容易下手。 45 | 46 | (3)注意多维数组的使用,一维不行用二维,二维不行用三维,特别是涉及到的元素比较多的时候,思路应该多往这边靠。 47 | 48 | #### 知识点讲解 49 | 50 | ```cpp 51 | 最小生产树: 52 | 最小生成树可以用kruskal(克鲁斯卡尔)算法或prim(普里姆)算法求出。 53 | 在一给定的无向图G = (V, E) 中,(u, v) 代表连接顶点 u 与顶点 v 的边(即),而 w(u, v) 代表此边的权重,若存在 T 为 E 的子集(即)且为无循环图,使得 54 | 的 w(T) 最小,则此 T 为 G 的最小生成树。 55 | 最小生成树其实是最小权重生成树的简称。 56 | Kruskal算法简述 57 | 假设 WN=(V,{E}) 是一个含有 n 个顶点的连通网,则按照克鲁斯卡尔算法构造最小生成树的过程为:先构造一个只含 n 个顶点,而边集为空的子图,若将该子图中各个顶点看成是各棵树上的根结点,则它是一个含有 n 棵树的一个森林。之后,从网的边集 E 中选取一条权值最小的边,若该条边的两个顶点分属不同的树,则将其加入子图,也就是说,将这两个顶点分别所在的两棵树合成一棵树;反之,若该条边的两个顶点已落在同一棵树上,则不可取,而应该取下一条权值最小的边再试之。依次类推,直至森林中只有一棵树,也即子图中含有 n-1条边为止。 [1] 58 | Prime算法简介: 59 | 最小生成树和最短路径一样,都是在实际中非常常见的图算法问题。 60 | 同样也有专门的算法来构造图的最小生成树。 61 | Prime算法是求解最小生成树问题最常用的算法,思想和上次讲解的 最短路径Dijkstra算法 有些接近。 62 | 1 把所有节点分成两类,一类是已经加入到了 当前的生成树中(集合 Y) ,一类是还没有加入当前的生成树中(集合N)。 63 | PS: 显然,这种分类可以用flag来设置。 64 | 2 最终的生成树是一步一步构造的,所以说是 “当前的”生成树。 65 | 从 Y 中取得一个节点 Vy, 从 N 中取得一个节点 Vn. 使其满足 Vy和Vn之间边的权值最小。 66 | 3、 找到满足上述条件的节点后,把Vn结点从 N 移入 Y中。 67 | Ps: 具体代码实现是,flag值修改即可。 (最原始的做法,后续会有改进方式) 68 | 重复上述 2. 3. 两步,直到所有节点全部加入Y中。 69 | ``` 70 | 71 | 72 | 73 | 74 | 75 | #### 三、应试经验 76 | 77 | - 1、第1和2题**(尽量40min-60min完成)**,是属于简单模拟和程序设计基本能力的考察,这块分数**一定**要拿满! 78 | 79 | - 注意,控制前2道题的原因是:后面3个题目会比这2题难得多! 80 | - 2、第3题:大模拟题型**(时间上分配2小时左右)**,不需要多少算法知识,但是代码的实现细节会比价繁琐,这也是想要拿高分的一个难点! 81 | 82 | - 如果你是希望得到300分的程度,这题请不要放弃 83 | - 如果你希望得到400分的程度,那么第3题的100分也是必须要全部拿下的! 84 | - Tips:代码实现细节只能靠练习,这个速成不了。可以在考前这几天去官网的题库上加强一下第3题这个题型的练习! 85 | - 一般掌握,STL中的string会让你更加有底气,可以在CF上看别人代码,用STL的很多 86 | - 3、第4题:一般来说是比较正常难度的算法题,考察点**基本是搜索/图论的相关基本算法**! 87 | - 但是一般不会是直接的所谓“套个板子”就能得分的题目,需要结合题目要求做优化和调整。 88 | - 方法:现会员 89 | - 4、第5题:属于高难度的题目,一般来说拿到20%-30%的分数就很满意了,不用花费太多的时间在这。 90 | - 如果自身能力是无法AC掉第4题的,建议先去把第5题的简单数据(10%或者20%的数据)过掉,然后去检查前3题。 91 | 92 | - 一般的:不用过分相信在考场上学会以前没熟悉过的算法,当然还是可能的。 93 | 94 | 95 | 96 | 97 | 98 | 99 | #### 四、CSP的趋势 100 | 101 | 2019年,一个17级的同学说的: 102 | 103 | - 最近几年CSP认证(甚至包括CCF办的其他赛事)有个趋势: 104 | - 1、就是把问题分成几个子任务,子任务会比原问题简单,每个子任务占一定的分数。 105 | - 2、子任务大部分情况具有限制数据范围,**弱化条件**!以及容易构造特定解法的特征。 106 | - 3、由上面特征:可以抓住比较容易实现的几个子任务去实现一个“不完全”的代码,这样就能拿下这部分潜在的分数(**骗分技巧**!) 107 | 108 | -------------------------------------------------------------------------------- /02.CCF_CSP/CSP目录结构.md: -------------------------------------------------------------------------------- 1 | # CSP题解目录 2 | 3 | 4 | 5 | ## [CSP应试策略](02.CCF_CSP/CSP应试策略.md) 6 | 7 | ## 2013年 8 | 9 | - [2013年12月(CSP的开始)](./02.CCF_CSP/2013年/2013年12月.md) 10 | 11 | 12 | ## 2014年 13 | - [2014年03月](./02.CCF_CSP/2014年/2014年03月.md) 14 | - [2014年09月](./02.CCF_CSP/2014年/2014年09月.md) 15 | - [2014年12月](./02.CCF_CSP/2014年/2014年12月.md) 16 | 17 | 18 | ## 2015年 19 | - [2015年03月](./02.CCF_CSP/2015年/2015年03月.md) 20 | - [2015年09月](./02.CCF_CSP/2015年/2015年09月.md) 21 | - [2015年12月](./02.CCF_CSP/2015年/2015年12月.md) 22 | 23 | 24 | ## 2016年 25 | - [2016年03月](./02.CCF_CSP/2016年/2016年03月.md) 26 | - [2016年09月](./02.CCF_CSP/2016年/2016年09月.md) 27 | - [2016年12月](./02.CCF_CSP/2016年/2016年12月.md) 28 | 29 | ## 2017年 30 | - [2017年03月](./02.CCF_CSP/2017年/2017年03月.md) 31 | - [2017年09月](./02.CCF_CSP/2017年/2017年09月.md) 32 | - [2017年12月](./02.CCF_CSP/2017年/2017年12月.md) 33 | 34 | ## 2018年 35 | - [2018年03月](./02.CCF_CSP/2018年/2018年03月.md) 36 | - [2018年09月](./02.CCF_CSP/2018年/2018年09月.md) 37 | - [2018年12月](./02.CCF_CSP/2018年/2018年12月.md) 38 | 39 | ## 2019年 40 | - [2019年03月](./02.CCF_CSP/2019年/2019年03月.md) 41 | - [2019年09月](./02.CCF_CSP/2019年/2019年09月.md) 42 | - [2019年12月](./02.CCF_CSP/2019年/2019年12月.md) 43 | 44 | ## 2020年 45 | - [2020年06月(缓办-但是进行了)](./02.CCF_CSP/2020年/2020年06月.md) 46 | - [2020年09月](./02.CCF_CSP/2020年/2020年09月.md) 47 | - [2020年12月(新考试规则:smile:)](./02.CCF_CSP/2020年/2020年12月CSP考场环境.md) 48 | 49 | ## 2021年 50 | 51 | - 2021年04月 52 | - 2021年09月 53 | - [2021年12月](./02.CCF_CSP/2021年/2021年12月.md) 54 | 55 | 56 | 57 | ## 2022年:smile: 58 | 59 | - 2022年03月 60 | 61 | -------------------------------------------------------------------------------- /03.NowCoder/01.腾讯.md: -------------------------------------------------------------------------------- 1 | # 腾讯笔试 2 | 3 | 4 | ## 一、常考知识点 5 | 6 | 7 | ## 二、实习生 8 | 9 | ## 三、秋招 10 | 11 | 12 | ## 四、春招 -------------------------------------------------------------------------------- /03.NowCoder/05.华为.md: -------------------------------------------------------------------------------- 1 | # 华为2016校园招聘上机笔试题 2 | 3 | 4 | 5 | 6 | ## 一、最高分是多少 7 | 8 | 9 | 考点:模拟 10 | 我用的标记数组 11 | 12 | 这道题,有点像PTA中乙级的一道题目。 13 | 14 | ```cpp 15 | #include 16 | using namespace std; 17 | 18 | int tag[30005]; 19 | 20 | int main() 21 | { 22 | int n,m; 23 | while(~scanf("%d%d",&n,&m)) 24 | { 25 | for(int i=1;i<=n;++i) 26 | { 27 | scanf("%d",&tag[i]); 28 | } 29 | 30 | getchar(); 31 | 32 | for(int i=1;i<=m;++i) 33 | { 34 | char c; 35 | int a,b; 36 | scanf("%c %d%d",&c,&a,&b); 37 | 38 | // printf("char= %c ==\n",c); 39 | if('U'==c) 40 | { 41 | tag[a]=b; 42 | } 43 | else 44 | { 45 | int rt=-1; 46 | //测试数据中有a大于等于b的。。。 47 | if(a>b) 48 | { 49 | a^=b; 50 | b^=a; 51 | a^=b; 52 | } 53 | for(int j=a;j<=b;++j) 54 | { 55 | rt=max(rt,tag[j]); 56 | } 57 | 58 | printf("%d\n",rt); 59 | // printf("OK___%d\n",rt); 60 | } 61 | 62 | getchar(); 63 | } 64 | 65 | } 66 | 67 | 68 | return 0; 69 | } 70 | ``` 71 | 72 | 73 | 74 | 75 | 76 | ## 二、 77 | 78 | 79 | ```cpp 80 | #include 81 | using namespace std; 82 | 83 | struct node 84 | { 85 | string str; 86 | int tag; 87 | int num; 88 | 89 | node(string _str,int _tag) 90 | { 91 | 92 | str=_str; 93 | tag=_tag; 94 | num=1; 95 | } 96 | 97 | friend bool operator < (node a,node b) 98 | { 99 | return a.num rt; 124 | 125 | 126 | while(cin>>str>>tag) 127 | { 128 | int len=str.size(); 129 | int i=len-1; 130 | int tg=0; 131 | for(;i>=0;--i) 132 | { 133 | if('\\'==str[i]) 134 | { 135 | tg=1; 136 | break; 137 | } 138 | } 139 | 140 | string st; 141 | if(1==tg) 142 | { 143 | st=str.substr(i+1,len-i); 144 | } 145 | else 146 | { 147 | st=str; 148 | } 149 | 150 | 151 | 152 | 153 | int have=0;//表示没有 154 | node temp(st,tag); 155 | for(int i=0;i q; 181 | 182 | for(int i=0;i16) 191 | { 192 | out=q.top().str.substr(q.top().str.size()-16,16); 193 | } 194 | else 195 | { 196 | out=q.top().str; 197 | } 198 | 199 | cout< 14 | using namespace std; 15 | 16 | int dp[7]; 17 | void init() 18 | { 19 | dp[1]=1; 20 | dp[2]=dp[1]+1; 21 | dp[3]=dp[1]+dp[2]+1; 22 | dp[4]=dp[1]+dp[2]+dp[3]+1; 23 | dp[5]=dp[1]+dp[2]+dp[3]+dp[4]+1; 24 | dp[6]=dp[1]+dp[2]+dp[3]+dp[4]+dp[5]+1; 25 | } 26 | 27 | int main() 28 | { 29 | init(); 30 | int n; 31 | while(~scanf("%d",&n)) 32 | { 33 | printf("%d\n",dp[n]); 34 | } 35 | return 0; 36 | } 37 | ``` 38 | 39 | 40 | ## 四、最长公共连续子串 41 | 42 | 样例 43 | ```txt 44 | 用例: 45 | aaaaaaaabaafdh 46 | abafdh 47 | 48 | 对应输出应该为: 49 | 50 | 4 51 | ``` 52 | 53 | 54 | 55 | #### 百分之90 56 | ```cpp 57 | #include 58 | using namespace std; 59 | 60 | char one[55]; 61 | char two[55]; 62 | 63 | //以i结尾的最长连续的序列的长度 64 | int dp[55]; 65 | int solve(int lenOne,int lenTwo) 66 | { 67 | int rt=0; 68 | 69 | int MAX=max(lenOne,lenTwo); 70 | if(MAX==lenOne) 71 | { 72 | 73 | 74 | int tt=lenOne-lenTwo; 75 | //one开始的 76 | for(int i=0;i<=tt;++i) 77 | { 78 | int tag=0;//第1个还没有处理 79 | 80 | int index=i; 81 | for(int j=0;j 29 | #include 30 | #include 31 | using namespace std; 32 | 33 | enum color { 34 | NONE, WHITE, BLACK, //棋子颜色,NONE表示未落子 35 | }; 36 | struct weiqi { 37 | enum color board[19][19]; //棋盘上每个位置的落子 38 | }; 39 | 40 | int calc(struct weiqi *wq, int x, int y) 41 | { 42 | //TODO:(代码要写的地方) 43 | int row = y, col = x; 44 | enum color co = wq->board[row][col]; 45 | if(co == NONE){ 46 | return 0; 47 | } 48 | vector > dirs = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; 49 | queue > q; 50 | q.push(vector{row, col}); 51 | int cnt = 1; 52 | wq->board[row][col] = NONE; 53 | while(!q.empty()){ 54 | auto n = q.front(); 55 | q.pop(); 56 | for(auto d : dirs){ 57 | int r = n[0] + d[0], c = n[1] + d[1]; 58 | if(r < 0 || r >= 19 || c < 0 || c >= 19 || wq->board[r][c] != co){ 59 | continue; 60 | } 61 | q.push(vector{r, c}); 62 | cnt++; 63 | wq->board[r][c] = NONE; 64 | } 65 | } 66 | return cnt; 67 | } 68 | int input(struct weiqi *wq, int *x, int *y) 69 | { 70 | int row, col; 71 | int ret; 72 | char buf[80]; 73 | 74 | for (row = 0; row < 19; ++row) { 75 | if (fgets(buf, sizeof(buf), stdin) == NULL) 76 | return -1; 77 | if (strlen(buf) < 19) 78 | return -1; 79 | for (col = 0; col < 19; ++col) { 80 | switch (buf[col]) { 81 | case '0': 82 | wq->board[row][col] = NONE; 83 | break; 84 | case '1': 85 | wq->board[row][col] = WHITE; 86 | break; 87 | case '2': 88 | wq->board[row][col] = BLACK; 89 | break; 90 | default: 91 | return -1; 92 | } 93 | } 94 | } 95 | ret = fscanf(stdin, "%d,%d\n", x, y); 96 | if (ret != 2) 97 | return -1; 98 | for (row = 0 ; row < 19; ++row) { 99 | for (col = 0; col < 19; ++col) { 100 | fprintf(stderr, "%d ", wq->board[row][col]); 101 | } 102 | fprintf(stderr, "\n"); 103 | } 104 | fprintf(stderr, "x = %d, y = %d\n", *x, *y); 105 | return 0; 106 | } 107 | 108 | int main() 109 | { 110 | struct weiqi wq; 111 | int x = 0, y = 0; 112 | int cnt; 113 | 114 | memset(&wq, 0, sizeof(wq)); 115 | if (input(&wq, &x, &y) < 0) { 116 | fprintf(stderr, "error!\n"); 117 | return 1; 118 | } 119 | cnt = calc(&wq, x, y); 120 | 121 | printf("%d\n", cnt); 122 | return 0; 123 | } 124 | 125 | ``` 126 | 127 | #### (2)我的BFS代码,用的递归编程技巧 128 | 129 | ```cpp 130 | #include 131 | #include 132 | 133 | enum color { 134 | NONE, WHITE, BLACK, //棋子颜色,NONE表示未落子 135 | }; 136 | struct weiqi { 137 | enum color board[19][19]; //棋盘上每个位置的落子 138 | }; 139 | 140 | //---------------------------------------------------- 141 | int test[19][19];//辅助BFS,用于剪枝 142 | void BFS(struct weiqi *wq, int x, int y,int &res, int val) 143 | { 144 | if((x<0)||(y<0)||(x>18)||(y>18)) 145 | return ; 146 | 147 | if(val!=(wq->board[y][x])) 148 | return ; 149 | 150 | if(test[y][x]==0&&val==(wq->board[y][x])) 151 | { 152 | res++; 153 | test[y][x]=1; 154 | } 155 | else 156 | { 157 | return; 158 | } 159 | 160 | BFS(wq, x, y-1,res, val);//上 161 | BFS(wq, x, y+1,res, val);//下 162 | BFS(wq, x-1, y,res, val);//左 163 | BFS(wq, x+1, y,res, val);//右 164 | 165 | return ; 166 | } 167 | 168 | int calc(struct weiqi *wq, int x, int y) 169 | { 170 | //TODO: 171 | int res=0; 172 | int val = wq->board[y][x];//坑的地方 173 | if(val==0)//特殊情况 174 | { 175 | return 0; 176 | } 177 | 178 | BFS(wq, x, y,res, val); 179 | return res; 180 | } 181 | //------------------------------------------------------------------------ 182 | int input(struct weiqi *wq, int *x, int *y) 183 | { 184 | int row, col; 185 | int ret; 186 | char buf[80]; 187 | 188 | for (row = 0; row < 19; ++row) { 189 | if (fgets(buf, sizeof(buf), stdin) == NULL) 190 | return -1; 191 | if (strlen(buf) < 19) 192 | return -1; 193 | for (col = 0; col < 19; ++col) { 194 | switch (buf[col]) { 195 | case '0': 196 | wq->board[row][col] = NONE; 197 | break; 198 | case '1': 199 | wq->board[row][col] = WHITE; 200 | break; 201 | case '2': 202 | wq->board[row][col] = BLACK; 203 | break; 204 | default: 205 | return -1; 206 | } 207 | } 208 | } 209 | ret = fscanf(stdin, "%d,%d\n", x, y); 210 | if (ret != 2) 211 | return -1; 212 | for (row = 0 ; row < 19; ++row) { 213 | for (col = 0; col < 19; ++col) { 214 | fprintf(stderr, "%d ", wq->board[row][col]); 215 | } 216 | fprintf(stderr, "\n"); 217 | } 218 | fprintf(stderr, "x = %d, y = %d\n", *x, *y); 219 | return 0; 220 | } 221 | 222 | int main() 223 | { 224 | struct weiqi wq; 225 | int x = 0, y = 0; 226 | int cnt; 227 | 228 | memset(&wq, 0, sizeof(wq)); 229 | if (input(&wq, &x, &y) < 0) { 230 | fprintf(stderr, "error!\n"); 231 | return 1; 232 | } 233 | cnt = calc(&wq, x, y); 234 | 235 | printf("%d\n", cnt); 236 | return 0; 237 | } 238 | 239 | ``` 240 | 241 | #### (3)数据 242 | 243 | ```txt 244 | 0000000000000000000 245 | 0000011000000000000 246 | 0000001111000000000 247 | 0000001021000000000 248 | 0000001010100000000 249 | 0000000000000000000 250 | 0000000000000000000 251 | 0000000000000000000 252 | 0000000000000000000 253 | 0000000000000000000 254 | 0000000000000000000 255 | 0000000000000000000 256 | 0000000000000000000 257 | 0000000000000000000 258 | 0000000000000000000 259 | 0000000000000000000 260 | 0000000000000000000 261 | 0000000000000000000 262 | 0000000000000000000 263 | 5,1 264 | ``` 265 | 266 | #### (4)有用的经验 267 | 268 | 269 | 270 | 对于,C++,他给了我函数模块 271 | 还写了一个TODO 272 | 273 | 274 | 我就以为,只能在那个函数里面写,后面发现。。。(我提交之后,看别人的代码,发现他们有的————似乎也是这么做的)所以应该可以 275 | 我还可以在外面继续写其他函数。。。。还可以写全局变量。。。 276 | 277 | 278 | 这次的BFS,我AC掉了 279 | 本来想用队列和bool标记有没有被 280 | 281 | PS:其实要是提交C语言啥的,,,,还没有这些模块啥的出来。。。。所以,应该上面的操作是合法的。 282 | 283 | 284 | 285 | ### 2、单链表排序(冒泡排序) 286 | 287 | [传送门](https://www.nowcoder.com/questionTerminal/4ef1efe2e0a14cd1bff0ab2c92df5905) 288 | 289 | 这种题目,其实是面试中的基础题,需要很熟练 290 | 291 | #### (1)别人AC的代码 292 | 293 | ```cpp 294 | #include 295 | #include 296 | 297 | struct node { 298 | int val; 299 | struct node *next; 300 | }; 301 | 302 | static void list_sort(struct node *head); 303 | 304 | struct node *list_create(int arr[], int size) 305 | { 306 | struct node *head = NULL; 307 | int i; 308 | for (i = size - 1; i >= 0; --i) { 309 | struct node *p = (struct node *)malloc(sizeof(struct node)); 310 | 311 | p->val = arr[i]; 312 | p->next = head; 313 | head = p; 314 | } 315 | return head; 316 | } 317 | static void list_print(struct node *head) 318 | { 319 | for (; head; head = head->next) { 320 | printf("%d", head->val); 321 | if (head->next) 322 | printf(" "); 323 | } 324 | printf("\n"); 325 | } 326 | static void list_free(struct node *head) 327 | { 328 | struct node *next; 329 | while (head) { 330 | next = head->next; 331 | free(head); 332 | head = next; 333 | } 334 | } 335 | static int input(int **arr, int *size) 336 | { 337 | int i; 338 | int ret; 339 | 340 | ret = fscanf(stdin, "%d\n", size); 341 | if (ret != 1) 342 | return -1; 343 | *arr = (int *)malloc(sizeof(int) * (*size)); 344 | for (i = 0; i < *size; ++i) { 345 | fscanf(stdin, "%d ", &(*arr)[i]); 346 | } 347 | return 0; 348 | } 349 | 350 | int main(int argc, char *argv[]) 351 | { 352 | struct node *head; 353 | int *arr = NULL; 354 | int size = 0; 355 | 356 | if (input(&arr, &size) < 0) { 357 | fprintf(stderr, "input error\n"); 358 | return 0; 359 | } 360 | head = list_create(arr, size); 361 | list_sort(head); 362 | list_print(head); 363 | list_free(head); 364 | free(arr); 365 | return 0; 366 | } 367 | 368 | void swap(node *p1, node *p2){ 369 | int val = p2->val; 370 | p2->val = p1->val; 371 | p1->val = val; 372 | } 373 | 374 | static void list_sort(struct node *head) 375 | { 376 | //TODO: 377 | if(head->next == NULL){ 378 | return; 379 | } 380 | 381 | struct node *p1, *p2; 382 | struct node *end = NULL; 383 | while(head->next != end){ 384 | p1 = head; 385 | p2 = head->next; 386 | while(1){ 387 | if(p1->val > p2->val){ 388 | swap(p1, p2); 389 | } 390 | p1 = p1->next; 391 | p2 = p2->next; 392 | if(end == NULL && p2 == NULL){ 393 | break; 394 | }else if(p2 == end){ 395 | break; 396 | } 397 | } 398 | end = p1; 399 | } 400 | } 401 | 402 | 403 | ``` 404 | 405 | #### 另一种解法 406 | 407 | ```cpp 408 | #include 409 | #include 410 | 411 | struct node { 412 | int val; 413 | struct node *next; 414 | }; 415 | 416 | static void list_sort(struct node *head); 417 | 418 | struct node *list_create(int arr[], int size) 419 | { 420 | struct node *head = NULL; 421 | int i; 422 | for (i = size - 1; i >= 0; --i) { 423 | struct node *p = (struct node *)malloc(sizeof(struct node)); 424 | 425 | p->val = arr[i]; 426 | p->next = head; 427 | head = p; 428 | } 429 | return head; 430 | } 431 | static void list_print(struct node *head) 432 | { 433 | for (; head; head = head->next) { 434 | printf("%d", head->val); 435 | if (head->next) 436 | printf(" "); 437 | } 438 | printf("\n"); 439 | } 440 | static void list_free(struct node *head) 441 | { 442 | struct node *next; 443 | while (head) { 444 | next = head->next; 445 | free(head); 446 | head = next; 447 | } 448 | } 449 | static int input(int **arr, int *size) 450 | { 451 | int i; 452 | int ret; 453 | 454 | ret = fscanf(stdin, "%d\n", size); 455 | if (ret != 1) 456 | return -1; 457 | *arr = (int *)malloc(sizeof(int) * (*size)); 458 | for (i = 0; i < *size; ++i) { 459 | fscanf(stdin, "%d ", &(*arr)[i]); 460 | } 461 | return 0; 462 | } 463 | 464 | int main(int argc, char *argv[]) 465 | { 466 | struct node *head; 467 | int *arr = NULL; 468 | int size = 0; 469 | 470 | if (input(&arr, &size) < 0) { 471 | fprintf(stderr, "input error\n"); 472 | return 0; 473 | } 474 | head = list_create(arr, size); 475 | list_sort(head); 476 | list_print(head); 477 | list_free(head); 478 | free(arr); 479 | return 0; 480 | } 481 | 482 | static void list_sort(struct node *head) 483 | { 484 | //TODO: 485 | node *h=head; 486 | node *a; 487 | node *ne; 488 | int temp=0; 489 | while(h){ 490 | ne=h->next; 491 | while(ne){ 492 | if(h->val>ne->val){ 493 | temp=h->val; 494 | h->val=ne->val; 495 | ne->val=temp; 496 | } 497 | ne=ne->next; 498 | } 499 | h=h->next; 500 | } 501 | 502 | } 503 | 504 | ``` 505 | 506 | #### (2)我的代码 507 | 508 | ```cpp 509 | #include 510 | #include 511 | 512 | struct node { 513 | int val; 514 | struct node *next; 515 | }; 516 | 517 | static void list_sort(struct node *head); 518 | 519 | struct node *list_create(int arr[], int size) 520 | { 521 | struct node *head = NULL; 522 | int i; 523 | for (i = size - 1; i >= 0; --i) { 524 | struct node *p = (struct node *)malloc(sizeof(struct node)); 525 | 526 | p->val = arr[i]; 527 | p->next = head; 528 | head = p; 529 | } 530 | return head; 531 | } 532 | static void list_print(struct node *head) 533 | { 534 | for (; head; head = head->next) { 535 | printf("%d", head->val); 536 | if (head->next) 537 | printf(" "); 538 | } 539 | printf("\n"); 540 | } 541 | static void list_free(struct node *head) 542 | { 543 | struct node *next; 544 | while (head) { 545 | next = head->next; 546 | free(head); 547 | head = next; 548 | } 549 | } 550 | static int input(int **arr, int *size) 551 | { 552 | int i; 553 | int ret; 554 | 555 | ret = fscanf(stdin, "%d\n", size); 556 | if (ret != 1) 557 | return -1; 558 | *arr = (int *)malloc(sizeof(int) * (*size)); 559 | for (i = 0; i < *size; ++i) { 560 | fscanf(stdin, "%d ", &(*arr)[i]); 561 | } 562 | return 0; 563 | } 564 | 565 | int main(int argc, char *argv[]) 566 | { 567 | struct node *head; 568 | int *arr = NULL; 569 | int size = 0; 570 | 571 | if (input(&arr, &size) < 0) { 572 | fprintf(stderr, "input error\n"); 573 | return 0; 574 | } 575 | // printf("OK\n"); 576 | head = list_create(arr, size); 577 | 578 | list_sort(head); 579 | list_print(head); 580 | list_free(head); 581 | free(arr); 582 | return 0; 583 | } 584 | 585 | static void list_sort(struct node *head) 586 | { 587 | //TODO: 588 | if (head == NULL)//无节点 589 | return; 590 | 591 | struct node* tail = NULL; 592 | while (tail != head->next)//不满足则1个节点,否则>1个节点 593 | { 594 | struct node* cur = head ; 595 | 596 | while (cur->next != tail) 597 | { 598 | if (cur->val>cur->next->val) 599 | { //交换节点 600 | 601 | cur->val = (cur->val)^(cur->next->val); 602 | cur->next->val = (cur->val)^(cur->next->val); 603 | cur->val = (cur->val)^(cur->next->val); 604 | } 605 | 606 | cur = cur->next; 607 | 608 | }//#end while 609 | 610 | tail = cur;//前移 611 | 612 | }//#end 最外层 while 613 | 614 | 615 | } 616 | ``` 617 | 618 | 619 | 620 | ### 3、出栈顺序 621 | 622 | [传送门](https://www.nowcoder.com/questionTerminal/37dafde80fa2445d91f6d7ae18795668) 623 | 624 | #### (1)方法一next_permutation 625 | 626 | - 一个个排列筛选 627 | 628 | ```cpp 629 | #include 630 | #include 631 | #include 632 | #include 633 | using namespace std; 634 | const int maxn=100000+5; 635 | 636 | char test[maxn]; 637 | int num[maxn*2];//序列,1表示入栈,0表示出栈 638 | int tag=0;//多少个字符 639 | 640 | void solution(char test[], int num[], int tag) 641 | { 642 | stack res; 643 | int temp=0; 644 | for(int i=1; i<=tag*2 ;i++) 645 | { 646 | if(num[i]) 647 | { 648 | res.push(test[temp++]); 649 | } 650 | else 651 | { 652 | 653 | printf("%c",res.top()); 654 | res.pop(); 655 | } 656 | } 657 | 658 | printf("\n"); 659 | } 660 | 661 | 662 | int demo() 663 | { 664 | int input=0; 665 | int output=0; 666 | int k=1; 667 | while((input!=tag)&&(output!=tag)) 668 | { 669 | if(k>2*tag) 670 | { 671 | return 0; 672 | } 673 | 674 | if(num[k]==1) 675 | { 676 | input++; 677 | } 678 | else 679 | { 680 | output++; 681 | } 682 | 683 | if(output>input) 684 | { 685 | return 0; 686 | } 687 | 688 | k++; 689 | } 690 | 691 | return 1; 692 | } 693 | 694 | int main() 695 | { 696 | gets(test); 697 | for(int i=0; test[i]!='\0'; i++) 698 | { 699 | tag++; 700 | } 701 | 702 | for(int i=1; i<=2*tag ; i+=2) 703 | { 704 | num[i]=1; 705 | } 706 | 707 | solution(test, num, tag); 708 | while(next_permutation(num+1,num+2*tag+1)) 709 | { 710 | if(demo()) 711 | { 712 | solution(test, num, tag); 713 | } 714 | 715 | } 716 | //这种全排列的还不够好,还可以辅助卡特兰数进行break 717 | // 方法2:栈+DFS,然后在上面剪枝 718 | // printf("函数结束"); 719 | 720 | return 0; 721 | } 722 | 723 | ``` 724 | 725 | #### (2)方法2(栈+DFS+剪枝)(没有完成——) 726 | 727 | ```cpp 728 | #include 729 | #include 730 | #include 731 | using namespace std; 732 | const int maxn=100000+5; 733 | 734 | char test[maxn]; 735 | int num[maxn*2];//序列,1表示入栈,0表示出栈 736 | int tag=0;//多少个字符 737 | int input; 738 | int output; 739 | 740 | int pre=0;//当前复赋值的点 741 | 742 | void solution(char test[], int num[], int tag) 743 | { 744 | stack res; 745 | int temp=0; 746 | for(int i=1; i<=tag*2 ;i++) 747 | { 748 | if(num[i]) 749 | { 750 | res.push(test[temp++]); 751 | } 752 | else 753 | { 754 | 755 | printf("%c",res.top()); 756 | res.pop(); 757 | } 758 | } 759 | 760 | printf("\n"); 761 | } 762 | 763 | //input余下的可以入栈的数 764 | //output下的可以出栈的数 765 | //tag是字母的数目 766 | void DFS(int input, int output) 767 | { 768 | if((tag-input)>(tag-output)) //出 769 | { 770 | pre++; 771 | num[pre]=0; 772 | output--; 773 | 774 | DFS(input, output); 775 | } 776 | 777 | if(input>0)//入 778 | { 779 | pre++; 780 | num[pre]=1; 781 | input--; 782 | 783 | DFS(input, output); 784 | } 785 | 786 | if((num[pre]==0)&&(output==0)) 787 | { 788 | solution(test, num, tag); 789 | // cout<<"OKKKKK"< 848 | unsigned int align_n(unsigned int size, int n) 849 | { 850 | 851 | 852 | unsigned int test=(1< 899 | unsigned int align_n(unsigned int size, int n) 900 | { 901 | 902 | 903 | unsigned int test=(1< 960 | #include 961 | #include 962 | static void heap_arrange(int arr[], int cur, int cnt); 963 | 964 | static int heap_verify(int arr[], int cnt) 965 | { 966 | int i; 967 | for (i = 0; i < cnt / 2; ++i) { 968 | int lhs = 2 * i + 1; 969 | int rhs = 2 * i + 2; 970 | 971 | if (lhs < cnt && arr[i] > arr[lhs]) { 972 | fprintf(stderr, "arr[%d]:%d > arr[%d]:%d\n", i, arr[i], lhs, arr[lhs]); 973 | return -1; 974 | } 975 | if (rhs < cnt && arr[i] > arr[rhs]) { 976 | fprintf(stderr, "arr[%d]:%d > arr[%d]:%d\n", i, arr[i], rhs, arr[rhs]); 977 | return -1; 978 | } 979 | } 980 | return 0; 981 | } 982 | 983 | static void heap_print(int arr[], int cnt) 984 | { 985 | int layer = 0, num = 0; 986 | for (layer = 0; num < cnt; ++layer) { 987 | int i = 0; 988 | for (i = 0 ; i < (1 << layer) && num < cnt ; ++i) 989 | printf("%3d ", arr[num++]); 990 | printf("\n"); 991 | } 992 | } 993 | static void heap_sort(int arr[], int cnt) 994 | { 995 | int i; 996 | 997 | printf("origin:\n"); 998 | heap_print(arr, cnt); 999 | // 建堆 1000 | for (i = cnt / 2 - 1; i >= 0; --i) { 1001 | heap_arrange(arr, i, cnt); 1002 | } 1003 | printf("make heap:\n", i); 1004 | heap_print(arr, cnt); 1005 | assert(heap_verify(arr, cnt) == 0); 1006 | for (i = cnt - 1; i > 0; --i) { 1007 | int tmp; 1008 | tmp = arr[0]; 1009 | arr[0] = arr[i]; 1010 | arr[i] = tmp; 1011 | printf("sort i=%d\n", i); 1012 | heap_print(arr, cnt); 1013 | heap_arrange(arr, 0, i); 1014 | heap_print(arr, cnt); 1015 | assert(heap_verify(arr, i) == 0); 1016 | } 1017 | printf("sorted:\n"); 1018 | heap_print(arr, cnt); 1019 | } 1020 | static int input(int **arr, int *size) 1021 | { 1022 | int i; 1023 | int ret; 1024 | 1025 | ret = fscanf(stdin, "%d\n", size); 1026 | if (ret != 1) 1027 | return -1; 1028 | *arr = (int *)malloc(sizeof(int) * (*size)); 1029 | for (i = 0; i < *size; ++i) { 1030 | fscanf(stdin, "%d ", &(*arr)[i]); 1031 | } 1032 | return 0; 1033 | } 1034 | 1035 | int main(int argc, char *argv[]) 1036 | { 1037 | int *arr = NULL; 1038 | int cnt = 0; 1039 | int i; 1040 | 1041 | if (input(&arr, &cnt) < 0) { 1042 | fprintf(stderr, "input error\n"); 1043 | return 0; 1044 | } 1045 | heap_sort(arr, cnt); 1046 | return 0; 1047 | } 1048 | // 调整为小顶堆 1049 | static void heap_arrange(int arr[], int cur, int cnt) //调整为小顶堆 1050 | { 1051 | int heaptop_val = arr[cur]; //堆顶的值 1052 | while (cur < cnt) { 1053 | int left = 2 * cur + 1; 1054 | int right = 2 * cur + 2; 1055 | int min = -1; 1056 | int min_val = heaptop_val; 1057 | if (left < cnt && arr[left] < min_val) { //检查是否比左节点大 1058 | min = left; 1059 | min_val = arr[left]; 1060 | } 1061 | if (right < cnt && arr[right] < min_val) {//检查是否比右节点大 1062 | min = right; 1063 | } 1064 | if (min == -1) 1065 | break; 1066 | arr[cur] = arr[min]; 1067 | cur = min; 1068 | } 1069 | arr[cur] = heaptop_val; 1070 | } 1071 | 1072 | ``` 1073 | 1074 | 1075 | 1076 | ### 3.最优二叉树(填空题)—未解决 1077 | 1078 | ```cpp 1079 | #include 1080 | #include 1081 | #include 1082 | #include 1083 | 1084 | struct node { 1085 | int left, right, parent; 1086 | int val; 1087 | }; 1088 | 1089 | void tree_print(const struct node arr[], int cnt) 1090 | { 1091 | int i; 1092 | for (i = 0; i < cnt; ++i) { 1093 | fprintf(stderr, "%d: {left:%d,right:%d,parent:%d,val:%d}\n" 1094 | , i, arr[i].left, arr[i].right, arr[i].parent, arr[i].val); 1095 | } 1096 | } 1097 | 1098 | void tree_output(FILE *fp, const struct node arr[], int old_cnt, int cnt) 1099 | { 1100 | int i; 1101 | fprintf(fp, "```mermaid\n"); 1102 | fprintf(fp, "graph TD\n"); 1103 | for (i = 0; i < cnt; ++i) { 1104 | if (i < old_cnt) 1105 | fprintf(fp, "\tn%d[n%d:%d]\n", i, i, arr[i].val); 1106 | else 1107 | fprintf(fp, "\tn%d((%d))\n", i, arr[i].val); 1108 | 1109 | if (arr[i].parent >= 0) { 1110 | fprintf(fp, "\tn%d --> n%d\n", i, arr[i].parent); 1111 | } 1112 | } 1113 | fprintf(fp, "```\n"); 1114 | } 1115 | 1116 | int build_tree(struct node arr[], int cnt); 1117 | 1118 | static int input(int **arr, int *size) 1119 | { 1120 | int i; 1121 | int ret; 1122 | 1123 | ret = fscanf(stdin, "%d\n", size); 1124 | if (ret != 1) 1125 | return -1; 1126 | if (*size <= 0) 1127 | return -1; 1128 | *arr = (int *)malloc(sizeof(int) * (*size)); 1129 | for (i = 0; i < *size; ++i) { 1130 | fscanf(stdin, "%d ", &(*arr)[i]); 1131 | } 1132 | return 0; 1133 | } 1134 | int main(int argc, char *argv[]) 1135 | { 1136 | int *vals = NULL; 1137 | int cnt = 0; 1138 | struct node *arr; 1139 | int i; 1140 | 1141 | if (input(&vals, &cnt) < 0) { 1142 | fprintf(stderr, "input error\n"); 1143 | return 0; 1144 | } 1145 | arr = (struct node *)malloc(sizeof(struct node) * cnt * 3); 1146 | 1147 | for (i = 0; i < cnt; ++i) { 1148 | arr[i].left = -1; 1149 | arr[i].right = -1; 1150 | arr[i].parent = -1; 1151 | arr[i].val = vals[i]; 1152 | } 1153 | 1154 | int newcnt = build_tree(arr, cnt); 1155 | tree_output(stdout, arr, cnt, newcnt); 1156 | free(vals); 1157 | free(arr); 1158 | return 0; 1159 | } 1160 | 1161 | // 建树,返回树的根节点 1162 | int build_tree(struct node arr[], int cnt) 1163 | { 1164 | while (1) { 1165 | int i; 1166 | int min1 = -1; //权值最小的节点编号 1167 | int min2 = -1; //权值第二小的节点编号 1168 | int root_node = 0; //根节点(没有父节点)的个数 1169 | 1170 | for (i = 0; i < cnt; ++i) { 1171 | if (arr[i].parent>= 0) //拥有父节点,则跳过这个结点 1172 | continue; 1173 | ++root_node; //根节点加1 1174 | if (min1 < 0) { 1175 | min1 = i; 1176 | } else if (arr[i].val < arr[min1].val) { //出现比第一更小的,更新 1177 | min2 = min1; 1178 | min1 = i; 1179 | } else if (min2 < 0) { 1180 | min2 = i; 1181 | } else if (arr[i].val < arr[min2].val) { //当前节点权值比第二小节点更小 1182 | min2 = i; 1183 | } 1184 | } 1185 | if (root_node < 2) 1186 | break; 1187 | arr[cnt].left = min2; 1188 | arr[cnt].right = min1; 1189 | arr[cnt].val = arr[min1].val + arr[min2].val; 1190 | arr[cnt].parent = -1; 1191 | arr[min1].parent = cnt; 1192 | arr[min2].parent = cnt; 1193 | ++cnt; 1194 | } 1195 | return cnt; 1196 | } 1197 | 1198 | ``` 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | ## C.深信服C卷(1/3) 1215 | 1216 | 1217 | 1218 | ### 1.字符串匹配(递归) 1219 | 1220 | 1221 | 1222 | ```txt 1223 | 看了别人的代码 1224 | 1225 | 发现,好久没有写代码。都没有考虑代码的健壮性 1226 | 1227 | 然后,看来他们的代码 1228 | 1229 | 感觉。自己对递归的思考还是没有很深刻。。。。 1230 | 1231 | 有人,还自己添加了头文件 1232 | 1233 | 还有人自己添加了一些函数,自行编写 1234 | ``` 1235 | 1236 | 1237 | 1238 | - 我用的递归写的。 1239 | 1240 | 递归写法套路: 1241 | 1242 | - 将函数抽象为已经实现了的,然后,在这个假设上面调用它 1243 | - 步步分情况分解问题,反正下一个问题不会,就给那个已知的递归函数 1244 | - 自己编写已知:也就是编写最终的最小问题解决方案。 1245 | 1246 | > 深信服CK:暴力、递归? 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | ```cpp 1255 | #include 1256 | #include 1257 | #include 1258 | 1259 | int match(const char *str, const char *pattern) 1260 | { 1261 | //TODO: 1262 | if( '\0'==str[0] && '\0'!=pattern[0] ) 1263 | { 1264 | return -1; 1265 | } 1266 | 1267 | if( '\0'!=str[0] && '\0'==pattern[0]) 1268 | { 1269 | return -1; 1270 | } 1271 | 1272 | if( '\0'==str[0] && '\0'==pattern[0] ) 1273 | { 1274 | return 0; 1275 | } 1276 | 1277 | 1278 | 1279 | 1280 | if( str[0]==pattern[0] || pattern[0]=='?') 1281 | { 1282 | return match( str+1, pattern+1 ); 1283 | } 1284 | else if( '*'==pattern[0] ) 1285 | { 1286 | //第1种,当成? 1287 | int a=match( str+1, pattern+1 ); 1288 | //第2种 1289 | int b=match( str+1, pattern); 1290 | if( 0==a|| 0==b ) 1291 | { 1292 | return 0; 1293 | } 1294 | else 1295 | { 1296 | return -1; 1297 | } 1298 | 1299 | } 1300 | else 1301 | { 1302 | return -1; 1303 | } 1304 | 1305 | 1306 | 1307 | } 1308 | 1309 | int input(char **src, char **ptn) 1310 | { 1311 | char buf[10240]; 1312 | 1313 | *src = NULL; 1314 | *ptn = NULL; 1315 | if (fgets(buf, sizeof(buf), stdin) == 0) 1316 | goto failed_; 1317 | *src = strdup(buf); 1318 | if (fgets(buf, sizeof(buf), stdin) == 0) 1319 | goto failed_; 1320 | *ptn = strdup(buf); 1321 | return 0; 1322 | failed_: 1323 | if (*src) 1324 | free(*src); 1325 | if (*ptn) 1326 | free(*ptn); 1327 | *src = NULL; 1328 | *ptn = NULL; 1329 | return -1; 1330 | } 1331 | 1332 | int main(int argc, char *argv[]) 1333 | { 1334 | char *src = NULL; 1335 | char *ptn = NULL; 1336 | 1337 | if (input(&src, &ptn) < 0) { 1338 | fprintf(stderr, "error\n"); 1339 | return 0; 1340 | } 1341 | 1342 | if (match(src, ptn) == 0) { 1343 | printf("match\n"); 1344 | } else { 1345 | printf("unmatch\n"); 1346 | } 1347 | return 0; 1348 | } 1349 | ``` 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | ### 2.字符串解析 1358 | 1359 | 1360 | 1361 | ### 3.围棋数气 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | ## D.深信服D卷(余1题没AC)(无100的) 1370 | 1371 | ### 1.二进制位反序(位运算AC) 1372 | 1373 | [传送门](https://www.nowcoder.com/questionTerminal/b6454cc72a4e4d178b76e31d319dff2d) 1374 | 1375 | ```cpp 1376 | #include 1377 | #include 1378 | 1379 | unsigned int reverse(unsigned int num) 1380 | { 1381 | //TODO: 1382 | unsigned int ret=0; 1383 | for(int i=0;i<32;++i) 1384 | { 1385 | unsigned int test=1< 2 | int solution[10]; 3 | 4 | int test(int n) 5 | { 6 | for(int i=0;i<10;i++) 7 | { 8 | if(solution[i]==n) 9 | { 10 | return 1; 11 | } 12 | } 13 | 14 | return 0; 15 | 16 | } 17 | 18 | int main() 19 | { 20 | int n; 21 | 22 | 23 | for(int i=0;i<10;i++) 24 | { 25 | unsigned int t=1; 26 | solution[i]=t< 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | class Trie { 10 | public: 11 | bool hava_Authority = false; 12 | bool isInherient = true; 13 | unordered_map ls; 14 | string name; 15 | Trie(bool au, string str) { 16 | hava_Authority = au; 17 | name = str; 18 | } 19 | Trie() { 20 | 21 | } 22 | void insert(bool au, vector str) { 23 | if (str.empty()) { 24 | this->isInherient = false; 25 | this->hava_Authority = true; 26 | return; 27 | } 28 | Trie* node = this; 29 | for (int i = 0; i < str.size(); i++) { 30 | if (node->ls.find(str[i]) == node->ls.end()) { 31 | Trie* tmp = new Trie(node->hava_Authority, str[i]); 32 | node->ls.insert(make_pair(str[i], tmp)); 33 | } 34 | node = node->ls.find(str[i])->second; 35 | } 36 | if (node->isInherient) 37 | node->hava_Authority = au; 38 | node->isInherient = false; 39 | } 40 | 41 | bool query(vector str) { 42 | Trie* node = this; 43 | for (int i = 0; i < str.size(); i++) { 44 | if (node->ls.find(str[i]) == node->ls.end()) { 45 | break; 46 | } 47 | node = node->ls.find(str[i])->second; 48 | } 49 | return node->hava_Authority; 50 | } 51 | 52 | void update() { 53 | Trie* node = this; 54 | for (auto it = node->ls.begin(); it != node->ls.end(); it++) { 55 | if (it->second->isInherient) { 56 | node->ls[it->first]->hava_Authority = node->hava_Authority; 57 | } 58 | node->ls[it->first]->update(); 59 | } 60 | } 61 | }; 62 | 63 | vector split(string str) { 64 | str += "/"; 65 | str = str.substr(1); 66 | vector res; 67 | string tmp; 68 | for (int i = 0; i < str.size(); i++) { 69 | if (str[i] == '/') { 70 | if (tmp.size()) 71 | res.push_back(tmp); 72 | continue; 73 | } 74 | tmp += str[i]; 75 | } 76 | return res; 77 | } 78 | 79 | int main() { 80 | Trie* root = new Trie(); 81 | int n; 82 | cin >> n; 83 | vector> query; 84 | while (n--) { 85 | string t; 86 | cin >> t; 87 | query.push_back(split(t)); 88 | } 89 | cin >> n; 90 | string a, b; 91 | while (n--) { 92 | cin >> a >> b; 93 | if (a == "Y") { 94 | root->insert(true, split(b)); 95 | } 96 | else { 97 | root->insert(false, split(b)); 98 | } 99 | } 100 | root->update(); 101 | for (int i = 0; i < query.size(); i++) { 102 | if (root->query(query[i])) { 103 | cout << "Y\n"; 104 | } 105 | else { 106 | cout << "N\n"; 107 | } 108 | } 109 | return 0; 110 | 111 | } 112 | -------------------------------------------------------------------------------- /03.NowCoder/S深信服/06.H卷(以前做了一点)(无100的——)/2访问权限(不会做)/别人用前缀树——AC的/前缀树.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/03.NowCoder/S深信服/06.H卷(以前做了一点)(无100的——)/2访问权限(不会做)/别人用前缀树——AC的/前缀树.png -------------------------------------------------------------------------------- /03.NowCoder/S深信服/06.H卷(以前做了一点)(无100的——)/3.手机号查询(超时70)/3.手机号查询.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/03.NowCoder/S深信服/06.H卷(以前做了一点)(无100的——)/3.手机号查询(超时70)/3.手机号查询.pdf -------------------------------------------------------------------------------- /03.NowCoder/S深信服/06.H卷(以前做了一点)(无100的——)/3.手机号查询(超时70)/别人AC的/Untitled1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1e3+5; 4 | typedef long long ll; 5 | 6 | unordered_mapvis; 7 | unordered_mapcnt; 8 | 9 | int main(){ 10 | ios::sync_with_stdio(false); 11 | cin.tie(0); 12 | int n,m; 13 | cin>>n>>m; 14 | string s; 15 | while(n--){ 16 | cin>>s; 17 | if(vis.count(s)) continue; 18 | vis[s]=true; 19 | setst; 20 | for(int i=0;i<11;i++){ 21 | for(int j=i;j<11;j++){ 22 | st.insert(s.substr(i,j-i+1)); 23 | } 24 | } 25 | for(auto t:st) cnt[t]++; 26 | } 27 | while(m--){ 28 | cin>>s; 29 | cout< 25 | #include 26 | using namespace std; 27 | int main() 28 | { 29 | int _min,N; 30 | int n; 31 | scanf("%d",&N); 32 | for(int i=0;i 63 | #include 64 | 65 | int test[10000+1]={0}; 66 | 67 | int main() 68 | { 69 | int L,M; 70 | 71 | while(~scanf("%d%d",&L,&M)) 72 | { 73 | memset(test,0,sizeof(test)); 74 | for(int i=0;i 115 | using namespace std; 116 | 117 | //表示留下的空位个数 118 | int one=0,two=0; //1X1和2X2的 119 | int solve[7]; 120 | //3X3用 121 | int modUse[4]={0,5,3,1}; 122 | 123 | int main() 124 | { 125 | 126 | while( ~scanf("%d%d%d%d%d%d", &solve[1] , &solve[2] , &solve[3], &solve[4], &solve[5], &solve[6] ) ) 127 | { 128 | if( 0==( solve[1] || solve[2] || solve[3] || solve[4] || solve[5] || solve[6] ) ) 129 | { 130 | break; 131 | } 132 | int need=0; 133 | one=0,two=0; 134 | //问题:+3 「注意理解」因为1/4=0,但是我需要1个,所以(1+3)/4=1,同理2,3。为了偏移,而且不影响(4+1)/4=4/4=1,能解决0/4=0,而且(0+3)/4 135 | need=need+solve[6]+solve[5]+solve[4]+ (solve[3]+3) /4; 136 | 137 | two=5*solve[4]+modUse[ solve[3]%4 ]; 138 | 139 | if( solve[2]>two ) 140 | { 141 | //问题:+8「注意理解」 142 | need+=( solve[2]-two+8 )/9; 143 | } 144 | 145 | //奇妙的写法 146 | one=36*need-36*solve[6]-25*solve[5]-16*solve[4]-9*solve[3]-4*solve[2]; 147 | if( solve[1]>one ) 148 | { 149 | //问题:+35「注意理解」 150 | need+=( solve[1]-one+35 )/36; 151 | } 152 | printf("%d\n",need); 153 | } 154 | 155 | return 0; 156 | } 157 | ``` 158 | 159 | 160 | 161 | 162 | 163 | ## 百练2746:[约瑟夫问题](http://bailian.openjudge.cn/practice/2746/)『低配版』 164 | 165 | - 因为这个题目n<=300所以才可以这么暴力 166 | - 不然,要用《具体数学》啥的进行抽象出数学公式 167 | 168 | ```cpp 169 | #include 170 | #include 171 | 172 | int main() 173 | { 174 | int array[301]={0};//表示数字在 175 | 176 | int n,m; 177 | 178 | while((~scanf("%d%d",&n,&m))&&(0!=n)&&(0!=m)) 179 | { 180 | memset(array,0,sizeof(array)); 181 | int count=0;//表示数数字到几号了 182 | int sum=0; 183 | int i=1;//当前序号 184 | while(1) 185 | { 186 | 187 | 188 | //判断有没有被筛 189 | if(0==array[i])//没有被筛掉了 190 | { 191 | ++count; //数数字 192 | 193 | } 194 | 195 | //判断需不需要筛掉 196 | if(m==count) 197 | { 198 | array[i]=1; 199 | ++sum;//筛掉了一个 200 | count=0;//继续下一次 201 | 202 | } 203 | 204 | if(sum==(n-1)) 205 | { 206 | 207 | break; 208 | } 209 | 210 | ++i; 211 | 212 | if((n+1)==i) 213 | { 214 | i=1; 215 | } 216 | } 217 | 218 | 219 | for(i=1;i<=n;++i) 220 | { 221 | if(!array[i]) 222 | { 223 | printf("%d\n",i); 224 | } 225 | } 226 | 227 | } 228 | 229 | 230 | return 0; 231 | } 232 | ``` 233 | 234 | 235 | 236 | ## 百练1833:[排列](http://bailian.openjudge.cn/practice/1833) 237 | 238 | ### (1)STL版本 239 | 240 | ```cpp 241 | #include 242 | using namespace std; 243 | int m,n,k; 244 | static const int maxn=1e5+5; 245 | int solve[maxn]; 246 | 247 | int main() 248 | { 249 | while( ~scanf("%d",&m) ) 250 | { 251 | int loop=m; 252 | while( loop-- ) 253 | { 254 | scanf("%d%d",&n,&k); 255 | for(int i=0; i 291 | #include 292 | 293 | int num[101]={0};//0表示与7无关 294 | 295 | void init() 296 | { 297 | //7的倍数 298 | int i=1; 299 | while(7*i<=100) 300 | { 301 | num[7*i]=1; 302 | ++i; 303 | } 304 | 305 | //个位和十位 306 | for(i=7;i<100;++i) 307 | { 308 | //短路原则,7的时候,i/10不会发生 309 | if((7==(i%10))||(7==(i/10))) 310 | { 311 | num[i]=1; 312 | } 313 | } 314 | } 315 | 316 | int main() 317 | { 318 | init(); 319 | int n; 320 | 321 | while(~scanf("%d",&n)) 322 | { 323 | int sum=0; 324 | for(int i=1;i<=n;++i) 325 | { 326 | if(0==num[i]) 327 | { 328 | sum+=i*i; 329 | } 330 | } 331 | 332 | printf("%d\n",sum); 333 | 334 | } 335 | 336 | return 0; 337 | } 338 | ``` 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | ## 百练2712:[细菌繁殖](http://bailian.openjudge.cn/practice/2712) 347 | 348 | - 低配版年月日 349 | - 广义的减法『模拟』 350 | 351 | ```cpp 352 | #include 353 | using namespace std; 354 | //平年为28,闰年为29 355 | int mp[13]={0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 356 | int n; 357 | int monthA,monthB; 358 | int dayA,dayB; 359 | long num; 360 | 361 | void init() 362 | { 363 | for(int i=1; i<13; ++i) 364 | { 365 | mp[i]+=mp[i-1]; 366 | } 367 | } 368 | 369 | long solve() 370 | { 371 | int loop; 372 | if( monthB==monthA ) 373 | { 374 | loop=dayB-dayA; 375 | } 376 | else 377 | { //广义的减法 378 | loop=(mp[monthB-1]+dayB)-( mp[monthA-1]+dayA ); 379 | } 380 | 381 | return num< 416 | using namespace std; 417 | 418 | int main() 419 | { 420 | int year; 421 | while( ~scanf("%d",&year) ) 422 | { 423 | if( (year%400==0) || (year%4==0)&&(year%100!=0) ) 424 | { 425 | printf("Y\n"); 426 | } 427 | else 428 | { 429 | printf("N\n"); 430 | } 431 | } 432 | return 0; 433 | } 434 | ``` 435 | 436 | 437 | 438 | ## 百练2707:[求一元二次方程的根](http://bailian.openjudge.cn/practice/2707)『精度很坑』 439 | 440 | - 2个坑 441 | 442 | ```cpp 443 | #include 444 | using namespace std; 445 | 446 | const double eps=1e-8; 447 | int main() 448 | { 449 | int loop; 450 | while( ~scanf("%d",&loop) ) 451 | { 452 | while( loop-- ) 453 | { 454 | int tag=1; 455 | double a,b,c; 456 | scanf("%lf%lf%lf",&a,&b,&c); 457 | 458 | double Data=b*b-4*a*c; 459 | //第1个坑的地方!delta为零的时候,即为尽可能小的时候 460 | if( fabs(Data)0 ) 465 | { 466 | tag=1; 467 | } 468 | else 469 | { 470 | tag=-1; 471 | } 472 | 473 | 474 | 475 | if( 0==tag ) 476 | { 477 | printf("x1=x2=%.5lf\n", -1.0*b/(2.0*a) ); 478 | } 479 | else if( 1==tag ) 480 | { 481 | Data=sqrt(Data); 482 | printf("x1=%.5lf;x2=%.5lf\n", (-1.0*b+Data)/(2.0*a), (-1.0*b-Data)/(2.0*a)); 483 | } 484 | else 485 | { 486 | Data=fabs(Data); 487 | Data=sqrt(Data); 488 | double imag=Data/(2.0*a); 489 | double real=-1.0*b/(2.0*a); 490 | //第2个坑的地方,这个地方,我是不清楚为啥不加上这个就AC不掉的。。 491 | if( fabs(real) 517 | using namespace std; 518 | 519 | int one[105]; 520 | int two[105]; //倒着存放数字,便于,我们少写1个for循环,仅此而已 521 | int dpPrefix[105]; 522 | int dpSuffixReverse[105]; 523 | 524 | 525 | int main() 526 | { 527 | int n; 528 | while( ~scanf("%d",&n) ) 529 | { 530 | for(int i=0; ione[pre] ) 545 | { 546 | dpPrefix[loop]=max( dpPrefix[pre]+1 ,dpPrefix[loop] ); 547 | } 548 | 549 | if( two[loop]>two[pre] ) 550 | { 551 | dpSuffixReverse[loop]=max( dpSuffixReverse[pre]+1, dpSuffixReverse[loop] ); 552 | } 553 | } 554 | } 555 | 556 | int del=0; 557 | for(int i=0; i 27 | using namespace std; 28 | 29 | int first; 30 | int second; 31 | int third; 32 | pair one; 33 | pair two; 34 | pair three; 35 | 36 | map mp; 37 | 38 | bool test() 39 | { 40 | int SumLeft=0; 41 | int SumRight=0; 42 | for(int i=0; i solve() 82 | { 83 | //暴力枚举,重就是1,轻就是-1 84 | pair ret; 85 | for( char c='A'; c<='L'; ++c ) 86 | { 87 | mp[c]=1; 88 | ret.first=c-'A'; 89 | ret.second=1; 90 | if( test() ) 91 | { 92 | return ret; 93 | } 94 | 95 | 96 | 97 | mp[c]=-1; 98 | ret.first=c-'A'; 99 | ret.second=-1; 100 | if( test() ) 101 | { 102 | return ret; 103 | } 104 | 105 | mp[c]=0;//复原 106 | } 107 | 108 | 109 | return ret; 110 | } 111 | 112 | 113 | 114 | int retNum( string str ) 115 | { 116 | //up 117 | if( 'u'==str[0] ) 118 | { 119 | return 1; 120 | } 121 | else if( 'd'==str[0] ) 122 | { 123 | return -1; 124 | } 125 | else 126 | { 127 | return 0; 128 | } 129 | } 130 | 131 | 132 | 133 | int main() 134 | { 135 | int n; 136 | while( ~scanf("%d",&n) ) 137 | { 138 | while( n-- ) 139 | { 140 | for(int c='A'; c<='L'; ++c ) 141 | { 142 | mp[c]=0; 143 | } 144 | string temp; 145 | cin>> one.first >> one.second >> temp; 146 | first=retNum( temp ); 147 | temp.clear(); 148 | 149 | cin>> two.first >> two.second >> temp; 150 | second=retNum( temp ); 151 | temp.clear(); 152 | 153 | cin>> three.first >> three.second >> temp; 154 | third=retNum( temp ); 155 | temp.clear(); 156 | 157 | 158 | pair demo=solve(); 159 | printf("%c is the counterfeit coin and it is %s. \n", 160 | demo.first+'A', 1==demo.second ? "heavy" : "light" ); 161 | 162 | } 163 | } 164 | 165 | return 0; 166 | } 167 | ``` 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | ## 百练4148:[生理周期](http://bailian.openjudge.cn/practice/4148) 178 | 179 | - 最坑的点:『注意,不能包括给定的时间』这个地方debug了我好久。。 180 | 181 | - 考点: 数论里的“中国剩余定理” 182 | 183 | ```cpp 184 | CurPos=Date+1;//如果是Date,就会是错误的,因为0000,答案就是0 185 | //『注意,不能包括给定的时间』 186 | ``` 187 | 188 | ```cpp 189 | #include 190 | using namespace std; 191 | 192 | //#define HACV 193 | //23,28,33 194 | int Date,pos,emotion,intelligence; 195 | 196 | int main() 197 | { 198 | int ID=1; 199 | while( 1 ) 200 | { 201 | scanf("%d%d%d%d",&pos, &emotion, &intelligence, &Date ); 202 | if( -4==(pos+emotion+intelligence+Date) ) 203 | { 204 | break; 205 | } 206 | 207 | int CurPos=-1; 208 | CurPos=Date+1;//如果是Date,就会是错误的,因为0000,答案就是0 209 | //『注意,不能包括给定的时间』 210 | 211 | //也不能是下面的!!!因为这样会导致可能会Date 212 | /* 213 | CurPos=max(CurPos,pos); 214 | CurPos=max(CurPos,emotion); 215 | CurPos=max(CurPos,intelligence); 216 | CurPos=max(CurPos,Date); 217 | */ 218 | 219 | 220 | //开始开始了 221 | while(1) 222 | { 223 | if( 0==(CurPos-intelligence)%33 ) 224 | { 225 | break; 226 | } 227 | ++CurPos; 228 | } 229 | 230 | while(1) 231 | { 232 | if( 0==(CurPos-emotion)%28 ) 233 | { 234 | break; 235 | } 236 | CurPos+=33; 237 | } 238 | 239 | 240 | while(1) 241 | { 242 | if( 0==(CurPos-pos)%23 ) 243 | { 244 | break; 245 | } 246 | //最小公倍数用于减少遍历次数 247 | CurPos+=(28*33); 248 | } 249 | 250 | 251 | printf("Case %d: the next triple peak occurs in %d days.\n", 252 | ID, CurPos-Date ); 253 | 254 | ++ID; 255 | 256 | } 257 | return 0; 258 | } 259 | ``` 260 | 261 | 262 | 263 | ## 百练2810:[完美立方](http://bailian.openjudge.cn/practice/2810) 264 | 265 | ```cpp 266 | #include 267 | using namespace std; 268 | 269 | int n,a,b,c,d; 270 | int solve[101]; //打表 271 | void init() 272 | { 273 | for(int i=1; i<101; ++i) 274 | { 275 | solve[i]=i*i*i; 276 | } 277 | } 278 | 279 | int main() 280 | { 281 | init(); 282 | while( ~scanf("%d",&n) ) 283 | { 284 | for( a=6; a<=n; ++a) 285 | { 286 | for(b=2; b 316 | using namespace std; 317 | 318 | int n,a=-500,b=-500,c=-500; 319 | 320 | int main() 321 | { 322 | 323 | while( ~scanf("%d",&n) ) 324 | { 325 | int num=-500; 326 | for(a=0; a<=n; ++a) 327 | { 328 | for(b=0; b<=n; ++b) 329 | { 330 | if( 0!=(a+b)%2 ) continue;//剪枝 331 | for(c=0; c<=n; ++c) 332 | { 333 | if( 0!=(b+c)%3 || 0!=(a+b+c)%5 ) 334 | { 335 | continue;//剪枝 336 | } 337 | else 338 | { 339 | num=max(num, a+b+c); 340 | } 341 | 342 | } 343 | } 344 | } 345 | 346 | printf("%d\n",num); 347 | } 348 | 349 | return 0; 350 | } 351 | ``` 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | ## 百练4138:[质数的和与积](http://bailian.openjudge.cn/practice/4138) 366 | 367 | - 筛法和打表 368 | 369 | ```cpp 370 | #include 371 | using namespace std; 372 | 373 | vector prim; 374 | static const int maxn=1e4+5; 375 | bool tag[maxn]={0}; 376 | void init() 377 | { 378 | tag[0]=1;//No prim 379 | tag[1]=1; 380 | tag[2]=0;//Yes 381 | for(int i=2; i<5004; ++i) 382 | { 383 | for(int j=2; i*j 434 | using namespace std; 435 | 436 | int a,b,c; 437 | 438 | int main() 439 | { 440 | while( ~scanf("%d%d%d",&a,&b,&c) ) 441 | { 442 | int sum=0; 443 | for(int x=0; ( (c-a*x)/b )>=0; ++x) 444 | { 445 | int num=(c-a*x)/b; 446 | if( c==(a*x+b*num) ) 447 | { 448 | ++sum; 449 | } 450 | } 451 | printf("%d\n",sum); 452 | } 453 | 454 | 455 | return 0; 456 | } 457 | ``` 458 | 459 | 460 | 461 | ## 百练4141:[砝码称重](http://bailian.openjudge.cn/practice/4141) 462 | 463 | - 坑点: 464 | 465 | ```cpp 466 | //注意,0是不要被遍历的,不然就会错 467 | for(int i=1; i 474 | using namespace std; 475 | 476 | const int maxn=(1+2+3+5+10+20)*1000+5; 477 | bool tag[maxn]; 478 | map mp; 479 | 480 | int main() 481 | { 482 | mp[0]=1; 483 | mp[1]=2; 484 | mp[2]=3; 485 | mp[3]=5; 486 | mp[4]=10; 487 | mp[5]=20; 488 | 489 | 490 | int a[6]; 491 | while( ~scanf("%d%d%d%d%d%d",&a[0], &a[1], &a[2], &a[3], &a[4], &a[5] ) ) 492 | { 493 | memset( tag , 0 , sizeof(tag) ); 494 | 495 | int loop[6]; 496 | //暴力解答 497 | for( loop[0]=0; loop[0]<=a[0]; ++loop[0] ) 498 | { 499 | for( loop[1]=0; loop[1]<=a[1]; ++loop[1] ) 500 | { 501 | for( loop[2]=0; loop[2]<=a[2]; ++loop[2] ) 502 | { 503 | for( loop[3]=0; loop[3]<=a[3]; ++loop[3] ) 504 | { 505 | for( loop[4]=0; loop[4]<=a[4]; ++loop[4] ) 506 | { 507 | for( loop[5]=0; loop[5]<=a[5]; ++loop[5] ) 508 | { 509 | int pos=0; 510 | for(int i=0; i<6; ++i) 511 | { 512 | pos+=( mp[i]*loop[i] ); 513 | } 514 | tag[pos]=true; 515 | } 516 | } 517 | } 518 | } 519 | } 520 | } 521 | 522 | 523 | int sum=0; 524 | //注意,0是不要被遍历的,不然就会错 525 | for(int i=1; i .\a.exe 35 | 5 5 5 1 36 | numnan 37 | numnan 38 | numnan 39 | numnan 40 | NO 41 | 42 | 正常应该如下 43 | PS C:\Users\whoway\Desktop> g++ .\one.cpp 44 | PS C:\Users\whoway\Desktop> .\a.exe 45 | 5 5 5 1 46 | num5 47 | num5 48 | num5 49 | num5 50 | YES 51 | ``` 52 | 53 | 54 | 55 | ```cpp 56 | #include 57 | using namespace std; 58 | const double eps=1e-9; 59 | int ans=0; 60 | 61 | //使用含有Len个元素的数组solve去组一个表达式 62 | void countSolve(double solve[], int Len) 63 | { 64 | if( 1==Len ) 65 | { 66 | if( fabs(solve[0]-24)1 ) 73 | { 74 | double nextUse[4]; 75 | int nextLen=Len-1; 76 | 77 | for(int i=0; i 143 | using namespace std; 144 | 145 | long long n; 146 | long long solve( long long num) 147 | { 148 | if( num<1 ) 149 | { 150 | return 0; 151 | } 152 | 153 | if( 1==num || 2==num ) 154 | { 155 | return 1; 156 | } 157 | 158 | return solve( num-1 )+ solve( num-2 ); 159 | } 160 | 161 | int main() 162 | { 163 | 164 | while( ~scanf("%lld", &n) ) 165 | { 166 | while( n-- ) 167 | { 168 | long long num; 169 | scanf("%lld",&num); 170 | printf("%lld\n", solve( num ) ); 171 | } 172 | } 173 | 174 | return 0; 175 | } 176 | ``` 177 | 178 | 179 | 180 | 181 | 182 | ## 百练3248:[最大公约数](http://bailian.openjudge.cn/practice/3248) 183 | 184 | - 辗转相除法 185 | 186 | ```cpp 187 | #include 188 | using namespace std; 189 | 190 | int a,b; 191 | int solve(int up, int down) 192 | { 193 | if( up 11 | using namespace std; 12 | 13 | //控制精度 14 | const double eps=1e-10; 15 | double solve(double left, double right) 16 | { 17 | 18 | 19 | while( right-left>eps ) 20 | { 21 | double mid=(right-left)/2+left; 22 | double f= mid*mid*mid- 5*mid*mid + 10*mid -80; 23 | if( f<0 ) 24 | { 25 | left=mid; 26 | } 27 | else if( f>0 ) 28 | { 29 | right=mid; 30 | } 31 | else 32 | { 33 | return mid; 34 | } 35 | } 36 | 37 | //也可以是return (right-left)/2+left啥的 38 | return left; 39 | } 40 | 41 | int main() 42 | { 43 | printf("%.9lf\n", solve(0.0,10.0) ); 44 | //system("pause"); 45 | return 0; 46 | } 47 | //答案是:5.705085930 48 | ``` 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | ## 百练2503:Babelfish: [在线翻译](http://bailian.openjudge.cn/practice/2503)「学习输入和输出技巧」 59 | 60 | - `cin.peek() `的返回值是一个char型的字符,其返回值是指针指向的当前字符,但它**只是观测指针**停留在当前位置的字符**并不会从输入流中取出**;如果要访问的字符是文件结束符,则函数值是EOF(-1) 。 61 | - `cin.get()`用来**从指定的输入流中提取一个字符**(包括空白字符),函数的返回值就是读入的字符。若遇到输入流中的文件结束符。 62 | - 类似纯C语言中的`getchar()` 63 | - [参考链接1](https://blog.csdn.net/K346K346/article/details/48213811) 64 | - [参考链接2](https://blog.csdn.net/qq_28584889/article/details/83308603) 65 | 66 | ```cpp 67 | #include 68 | using namespace std; 69 | 70 | map mp; 71 | char one[15],two[15]; 72 | int main() 73 | { 74 | 75 | while( 1 ) 76 | { 77 | scanf("%s %s",one,two); 78 | mp[ string(two) ]=string(one); 79 | getchar(); 80 | if( '\n'==cin.peek() ) //注意,这里就不能用getchar了,不然有时候可能会「误杀」 81 | { 82 | break; 83 | } 84 | } 85 | 86 | getchar(); 87 | char solve[15]; 88 | while( ~scanf("%s",solve) ) 89 | { 90 | if( 0==mp.count( string(solve) ) ) 91 | { 92 | printf("eh\n"); 93 | } 94 | else 95 | { 96 | printf("%s\n",mp[string(solve)].c_str() ); 97 | } 98 | } 99 | return 0; 100 | } 101 | ``` 102 | 103 | 104 | 105 | ## 百练3441:4 Values whose Sum is 0([快速找到和为0的4个数](http://bailian.openjudge.cn/practice/3441)) 106 | 107 | - //我使用map的时候,就 Time Limit Exceeded 了 108 | - 使用map的时候,用时12506ms「超时了」 109 | - 使用unordered_map,用时8477ms 110 | 111 | ```cpp 112 | #include 113 | using namespace std; 114 | 115 | const int maxn=4005; 116 | int a[maxn],b[maxn],c[maxn],d[maxn]; 117 | 118 | int main() 119 | { 120 | int n; 121 | while( ~scanf("%d",&n) ) 122 | { 123 | for(int i=0; i mp; //我使用map的时候,就 Time Limit Exceeded 了 129 | for(int i=0; i 11 | using namespace std; 12 | 13 | //分数比较,改公式 14 | bool cmp( pair a, pair b ) 15 | { 16 | return a.first*b.second > a.second*b.first; 17 | } 18 | 19 | int main() 20 | { 21 | int loop,need; 22 | while( ~scanf("%d%d",&loop,&need) ) 23 | { 24 | vector< pair > solve; 25 | int value,weight; 26 | while( loop-- ) 27 | { 28 | scanf("%d%d",&value,&weight); 29 | solve.push_back( make_pair(value,weight) ); 30 | } 31 | 32 | sort( solve.begin(), solve.end(), cmp ); 33 | double SumVaule=0.0; 34 | int index=0; 35 | int Len=solve.size(); 36 | while( need>0 && index 75 | using namespace std; 76 | 77 | int main() 78 | { 79 | int n,B; 80 | while( ~scanf("%d%d",&n,&B) ) 81 | { 82 | vector solve(n); 83 | for(int i=0; i=B ) 96 | { 97 | break; 98 | } 99 | ++index; 100 | } 101 | 102 | printf("%d\n", index+1 ); 103 | 104 | } 105 | 106 | return 0; 107 | } 108 | ``` 109 | 110 | 111 | 112 | ## 百练4137:[最小新整数](http://bailian.openjudge.cn/practice/4137) 113 | 114 | - 贪心算法错误 115 | 116 | ```cpp 117 | #include 118 | using namespace std; 119 | 120 | 121 | 122 | int main() 123 | { 124 | int loop; 125 | //while( ~scanf("%d",&loop) ) 126 | scanf("%d",&loop); 127 | { 128 | 129 | while( loop-- ) 130 | { 131 | getchar(); 132 | char solve[15]; 133 | int k; 134 | scanf("%s%d",solve, &k); 135 | //printf("solve====%s %d\n",solve,k ); 136 | int Len=strlen( solve ); 137 | int NumValue[Len]; 138 | int index=0; 139 | while( index0 ) 164 | { 165 | int temp=solve[i]-'0'; 166 | sum=sum*10+temp; 167 | 168 | } 169 | } 170 | printf("%d\n", sum ); 171 | //printf("\n"); 172 | } 173 | 174 | } 175 | 176 | return 0; 177 | } 178 | ``` 179 | 180 | 181 | 182 | 183 | 184 | ## 百练4005:[拼点游戏](http://bailian.openjudge.cn/practice/4005) 185 | 186 | - 只通过了样例, 187 | 188 | ```cpp 189 | #include 190 | using namespace std; 191 | 192 | //赛马贪心 193 | int FwinS( vector first, vector second ) 194 | { 195 | int Len=first.size(); 196 | if( 0==Len ) 197 | { 198 | return 0; 199 | } 200 | 201 | int loop=Len;//找到第1个大于等于first[0]的位置 202 | while( loop-- ) 203 | { 204 | if( second[loop]>= first[0] ) 205 | { 206 | break; 207 | } 208 | } 209 | 210 | //cout<<"111111111"<second[j] ) 220 | { 221 | ++Win; 222 | tag[j]=true; 223 | break; 224 | } 225 | } 226 | } 227 | 228 | //cout<<"222222"<=0; --j) 230 | { 231 | if( tag[j] ) 232 | { 233 | second.erase( second.begin()+j ); //易错点 234 | } 235 | } 236 | 237 | 238 | map mpSecond,mpfirst; 239 | for(int i=0; ib; 263 | } 264 | 265 | int main() 266 | { 267 | int n; 268 | while( ~scanf("%d",&n ) ) 269 | { 270 | if( 0==n ) 271 | { 272 | break; 273 | } 274 | 275 | vector first(n); 276 | vector second(n); 277 | int loop=n; 278 | while( loop-- ) 279 | { 280 | scanf("%d",&first[loop] ); 281 | } 282 | loop=n; 283 | while( loop-- ) 284 | { 285 | scanf("%d",&second[loop] ); 286 | } 287 | sort( first.begin(), first.end(), cmp ); 288 | sort( second.begin(), second.end(), cmp ); 289 | 290 | 291 | int Swin=FwinS( second , first ); 292 | int Cwin=FwinS( first, second ); 293 | Cwin= first.size()*4-Cwin; 294 | printf("%d %d\n", Swin, Cwin ); 295 | } 296 | 297 | return 0; 298 | } 299 | ``` 300 | 301 | -------------------------------------------------------------------------------- /04.北大百练/06.动态规划.md: -------------------------------------------------------------------------------- 1 | # 动态规划 2 | 3 | 4 | 5 | ```txt 6 | 一切的dp实际上都是在1个『有向无环图』上求单源点最短路的过程 7 | 所以,『BFS本身其实就是1个dp』 8 | ``` 9 | 10 | -------------------------------------------------------------------------------- /04.北大百练/07.深度优先搜索DFS.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/04.北大百练/07.深度优先搜索DFS.md -------------------------------------------------------------------------------- /04.北大百练/08.广度优先搜索BFS.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whoway/coding/43e8d43851e6f8b862162fafb626854e60f246cb/04.北大百练/08.广度优先搜索BFS.md -------------------------------------------------------------------------------- /04.北大百练/百练.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## [01.简单计算和模拟](./04.北大百练/01.简单计算和模拟.md) 4 | 5 | 6 | 7 | ## [02.枚举](./04.北大百练/02.枚举.md) 8 | 9 | 10 | 11 | ## [03.递归](./04.北大百练/03.递归.md) 12 | 13 | 14 | 15 | ## [04.二分查找](./04.北大百练/04.二分查找.md) 16 | 17 | 18 | 19 | ## [05.贪心算法](./04.北大百练/05.贪心算法.md) 20 | 21 | 22 | 23 | ## [06.动态规划](./04.北大百练/06.动态规划.md) 24 | 25 | 26 | 27 | ## [07.深度优先搜索DFS](./04.北大百练/07.深度优先搜索DFS.md) 28 | 29 | 30 | 31 | ## [08.广度优先搜索BFS](./04.北大百练/08.广度优先搜索BFS.md) 32 | 33 | 34 | 35 | 36 | 37 | > AtCoder训练思维的OJ 38 | 39 | - [AtCoder OJ传送门](https://atcoder.jp/) 40 | - 日本的一个刷题站点,AtCoder对于提升思维有帮助。特点:思维题,没有高级的数据结构等。 41 | - 网卡,可以用“梯子”,宝藏“刷题”站点 42 | 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 HACV 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## [Coding仓库](https://hacv.gitee.io/coding/#/) 4 | 5 | 6 | 7 | #### 01.说明 8 | 9 | - 这是我的博客附属的刷题记载分站 10 | - 1、全部使用`C++11`语法(部分由于无法支持C++11语法的,会直接使用C++98语法) 11 | - 2、代码会修改,尝试精简 12 | - 3、追求“良好的代码风格” ,再考虑精简性 13 | - 4、不保证效率最高性 14 | - 5、编译环境:`linux下g++` 15 | 16 | 17 | 18 | 19 | 20 | #### 02.:memo: 目录(update ing) 21 | 22 | 23 | 24 | 25 | - [:pushpin:Coding准备](README.md) 26 | - [Part01.『代码编辑器』](00.Pre/Part01.Vim和VScode使用手册.md) 27 | - [Part02.『刷题目录』](00.Pre/Part02.刷题目录.md) 28 | - [Part03.『STL刷题目录』](00.Pre/Part03.STL刷题目录.md) 29 | - [🎨第1章.PAT](01.PAT/PAT目录结构.md.md) 30 | - [01.乙级C++11版本](./01.PAT/01.乙级C++11版本.md) 31 | - [02.甲级C++11版本](./01.PAT/02.甲级C++11版本.md) 32 | - [03.顶级C++11版本](./01.PAT/03.顶级C++11版本.md) 33 | - [:musical_keyboard:第2章.CSP](./02.CCF_CSP/CSP目录结构.md) 34 | - [CSP应试策略](02.CCF_CSP/CSP应试策略.md) 35 | - [:gem:第3章.牛客网](./03.NowCoder/README.md) 36 | - [01.腾讯](03.NowCoder/01.腾讯.md) 37 | - 02.字节 38 | - 03.百度 39 | - 04.阿里 40 | - [05.华为](03.NowCoder/05.华为.md) 41 | - 06.美团 42 | - 07.京东 43 | - 08.网易 44 | - [09.深信服](03.NowCoder/09.深信服.md) 45 | - [:rocket:第4章.北大百练](404.md) 46 | 47 | 48 | 49 | 50 | 51 | 52 | #### 03.:memo: 后记 53 | 54 | #### 3.1.License 55 | 56 | 本仓库的内容绝打部分是作者写过的代码,有的参考别人想法的会注明来源。 57 | 在您引用本仓库内容或者对内容进行修改演绎时,请署名并以相同方式共享,谢谢。:smile: 58 | 转载文章请在开头明显处标明该页面地址 59 | 60 | 61 | 62 | #### 3.2.Thanks(ing) 63 | 64 | 如果你希望被添加到这个名单中,并且提交过 Issue 或者 PR,请与我联系。 65 | 66 | :email: whoway2017@qq.com 67 | -------------------------------------------------------------------------------- /_coverpage.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | - :pushpin:本项目为“Coding记录站点” 6 | - :book:零碎的记载PAT、CSP、牛客、北大百练题解 7 | - 🚀基于高质量的OJ生成的高效、高质的『刷题目录』 8 | 9 | 10 | 11 | [![stars](https://badgen.net/github/stars//HACV/Coding?icon=github&color=4ab8a1)](https://github.com/HACV/Coding) [![forks](https://badgen.net/github/forks//HACV/Coding?icon=github&color=4ab8a1)](https://github.com/HACV/Coding) 12 | 13 | [开始阅读](https://hacv.gitee.io/coding/#/) 14 | 15 | -------------------------------------------------------------------------------- /_sidebar.md: -------------------------------------------------------------------------------- 1 | 2 | - [:pushpin:Coding准备](README.md) 3 | - [Part01.『代码编辑器』](00.Pre/Part01.Vim和VScode使用手册.md) 4 | - [Part02.『刷题目录』](00.Pre/Part02.刷题目录.md) 5 | - [Part03.『STL刷题目录』](00.Pre/Part03.STL刷题目录.md) 6 | 7 | - [🎨第1章.PAT](01.PAT/PAT目录结构.md.md) 8 | - [:musical_keyboard:第2章.CSP](./02.CCF_CSP/CSP目录结构.md) 9 | - [:gem:第3章.牛客网](./03.NowCoder/README.md) 10 | - [:rocket:第4章.北大百练](./04.北大百练/百练.md) 11 | -------------------------------------------------------------------------------- /autoDeploy.sh: -------------------------------------------------------------------------------- 1 | git add . 2 | git commit -m "auto Deploy:smile: whoway 2021" 3 | git push github master -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Coding 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 164 | 409 | 410 | 411 | 412 |
413 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | --------------------------------------------------------------------------------