├── .gitignore ├── .idea ├── cplusplus.iml ├── encodings.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── ACM ├── 2017ACM集训 │ ├── ACMProgramming.iml │ ├── LICENSE │ ├── README.md │ ├── contest01 │ │ ├── A.java │ │ ├── B.java │ │ ├── C.java │ │ ├── D.java │ │ ├── E.java │ │ ├── F.java │ │ └── G.java │ ├── contest02 │ │ ├── A.java │ │ ├── B.java │ │ ├── C.java │ │ ├── D.java │ │ ├── E.java │ │ ├── F.java │ │ └── G.java │ ├── contest03 │ │ ├── A.java │ │ ├── B.java │ │ ├── BP1739.java │ │ ├── C.java │ │ ├── D.java │ │ ├── E.java │ │ ├── F.java │ │ ├── G.java │ │ └── P1797.java │ ├── contest04 │ │ ├── A.java │ │ ├── B.cpp │ │ ├── C.java │ │ ├── D.java │ │ └── G.cpp │ ├── contest05 │ │ ├── A.java │ │ ├── B.java │ │ ├── C.java │ │ └── D.java │ ├── contest06 │ │ ├── A.java │ │ ├── B.java │ │ └── C.java │ ├── contest07 │ │ └── A.c │ ├── contest09 │ │ └── A.java │ ├── contest10 │ │ ├── P2017.java │ │ └── P2018.java │ ├── contest12 │ │ ├── A.c │ │ └── B.java │ ├── contest14 │ │ └── P2026.java │ ├── lec01 │ │ ├── 1015.cpp │ │ ├── 1119.cpp │ │ ├── 1183.cpp │ │ ├── 1282.cpp │ │ ├── 1583.cpp │ │ ├── A.java │ │ ├── AAddB.java │ │ ├── AAddB2.java │ │ ├── ArraysDemo.java │ │ ├── BigInteger.cpp │ │ ├── DateTypeDemo.java │ │ ├── P1002.java │ │ ├── P1274.java │ │ ├── add.cpp │ │ ├── class.cpp │ │ ├── demo1.cpp │ │ ├── demo2.cpp │ │ ├── hdu1000.cpp │ │ ├── hdu1048_string.cpp │ │ ├── hdu1060_math.cpp │ │ ├── hdu1089_io.cpp │ │ ├── hdu1090_io.cpp │ │ ├── hdu1091_io.cpp │ │ ├── hdu1092_io.cpp │ │ ├── hdu1093_io.cpp │ │ ├── hdu1094_io.cpp │ │ ├── hdu1095_io.cpp │ │ ├── hdu1096_io.cpp │ │ ├── io.cpp │ │ ├── nefu65_math.cpp │ │ ├── outlilne.MD │ │ ├── qsort_sort.cpp │ │ ├── readme.MD │ │ ├── stack_array.cpp │ │ ├── stack_point.cpp │ │ ├── stl_sort.cpp │ │ ├── typeid.cpp │ │ └── year.cpp │ ├── lec02 │ │ ├── ArrayAlgorithm.java │ │ ├── ArrayDemo4.java │ │ ├── ArraysDemo.java │ │ ├── ArraysDemo2.java │ │ ├── ArraysDemo3.java │ │ ├── Practice1.java │ │ ├── Practice2.java │ │ ├── StringDemo1.java │ │ ├── cyclist.cpp │ │ ├── outline.MD │ │ ├── readme.MD │ │ ├── sqlist.c │ │ ├── union-find.cpp │ │ └── 蒜头君的魔法机.cpp │ ├── lec02pm │ │ ├── BigAddAB.java │ │ ├── BigIntegerDemo.java │ │ ├── EulerJudger.java │ │ ├── FuncParam.java │ │ ├── P1039.java │ │ └── P1298.java │ ├── lec03am │ │ ├── NullPointerDemo.java │ │ ├── P1141.java │ │ ├── P1141a.java │ │ ├── P1141b.java │ │ ├── SortDemo.java │ │ ├── SortDemo2.java │ │ ├── SortDemo3.java │ │ ├── VectorDemo.java │ │ ├── aoj1042_factorial.cpp │ │ ├── nefu563_duck.cpp │ │ ├── nefu564_hanoi.cpp │ │ ├── outline.MD │ │ └── readme.MD │ ├── lec04 │ │ ├── LinkedListDemo.java │ │ ├── MapDemo.java │ │ ├── P1221.java │ │ ├── P1321.java │ │ ├── P1582.java │ │ ├── P1853.java │ │ ├── StackDemo.java │ │ └── outline.MD │ ├── lec05 │ │ ├── AOJ1174图书馆占座.py │ │ └── readme.MD │ ├── lec06 │ │ ├── P1944.java │ │ ├── P1995.java │ │ ├── outline.MD │ │ ├── readme.MD │ │ ├── 最少硬币问题.cpp │ │ ├── 跳跃游戏1.py │ │ └── 跳跃游戏2.py │ ├── lec07 │ │ ├── BinaryTree.java │ │ └── P1997.java │ ├── lec09 │ │ ├── AOJ1460Alice的车牌号.cpp │ │ └── readme.MD │ ├── lec10 │ │ ├── KruskalTree.java │ │ ├── PrimTree.java │ │ └── nyist042.cpp │ ├── lec11 │ │ ├── DijkstraDemo.java │ │ └── FloydDemo.java │ ├── lec13 │ │ ├── BinaryTree.java │ │ ├── MergeSort.c │ │ ├── MergeSort.java │ │ └── QuickSort.c │ ├── lec15 │ │ ├── ToposortDemo.java │ │ ├── phi.cpp │ │ ├── readme.md │ │ └── topoSort.cpp │ ├── ugly.cpp │ └── week2contest │ │ ├── A.java │ │ ├── B.java │ │ ├── C.java │ │ ├── D.java │ │ ├── E.java │ │ ├── F.java │ │ ├── G.java │ │ ├── H.java │ │ └── I.java ├── 2019ACM中级算法网络课(bilibli直播) │ ├── .gitignore │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── lec │ │ └── outline.md │ ├── lec01 │ │ ├── A.cpp │ │ ├── A1.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── C1.cpp │ │ ├── D.cpp │ │ ├── D1.cpp │ │ └── outline.md │ ├── lec02 │ │ ├── A_cube.cpp │ │ ├── A_sqrt.cpp │ │ ├── A_square.cpp │ │ ├── I.cpp │ │ ├── I_TLE.cpp │ │ ├── Sieve.cpp │ │ ├── 数论.md │ │ ├── 素数.md │ │ └── 组合数学.md │ ├── lec03 │ │ ├── app1.cpp │ │ ├── app1b.cpp │ │ ├── app2.cpp │ │ ├── array_bad.cpp │ │ ├── map.cpp │ │ ├── mirror.cpp │ │ ├── mirror2.cpp │ │ ├── outline.MD │ │ ├── queue.cpp │ │ ├── stack.cpp │ │ ├── str2int.cpp │ │ ├── str2int2.cpp │ │ ├── strstr.cpp │ │ ├── strstr2.cpp │ │ └── vector.cpp │ ├── lec04 │ │ ├── bfs.cpp │ │ └── dfs.cpp │ ├── lec05 │ │ ├── Dijsktra.cpp │ │ ├── topSort.cpp │ │ └── 并查集.cpp │ └── main.cpp ├── 2019ACM集训 │ ├── .gitignore │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── lec01sort │ │ ├── binary_search.cpp │ │ ├── bubble.cpp │ │ ├── bubble_sort.cpp │ │ ├── insert.cpp │ │ ├── insert2.cpp │ │ ├── lower_bound.cpp │ │ ├── outline.MD │ │ ├── qsort.cpp │ │ ├── quick_sort.cpp │ │ ├── quick_sort2.cpp │ │ └── select.cpp │ ├── lec02string │ │ ├── Trie.java │ │ ├── outline.MD │ │ └── trie.cpp │ ├── lec03math │ │ ├── NTL_1_A_PrimeFactorize.cpp │ │ ├── NTL_1_B_Power.cpp │ │ ├── NTL_1_C_LCM.cpp │ │ ├── NTL_1_D_EulerFunction.cpp │ │ ├── NTL_1_E_exGCD.cpp │ │ ├── 数论.md │ │ ├── 素数.md │ │ └── 组合数学.md │ ├── lec04dfsbfs │ │ ├── 1212a.cpp │ │ ├── 1580a.cpp │ │ ├── 1580b.cpp │ │ ├── ALDS1_5_A_DFS.cpp │ │ ├── ALDS1_5_A_ExhaustiveSearch.cpp │ │ ├── bfs.cpp │ │ ├── dfs.c │ │ ├── dfs2.c │ │ ├── dfs_perm.cpp │ │ ├── dfs_subset.cpp │ │ ├── dfs_迷宫.cpp │ │ ├── n的全排列.cpp │ │ ├── per1.cpp │ │ ├── per2.cpp │ │ ├── perm.c │ │ ├── perm0.cpp │ │ ├── prob.md │ │ ├── search.md │ │ ├── subSet.cpp │ │ └── subset2.cpp │ ├── lec05dp │ │ ├── 1164奶牛零食_动态规划(逆向计算).cpp │ │ ├── 1171_方案数_(同数字金字塔,动态规划).cpp │ │ ├── 动态规划解题总览.pdf │ │ ├── 最少硬币问题.cpp │ │ ├── 背包九讲.pdf │ │ ├── 跳跃游戏1.py │ │ └── 跳跃游戏2.py │ ├── lec06tree │ │ ├── 回文串.cpp │ │ └── 解密QQ号.cpp │ ├── lec07graph │ │ ├── 1317并查集.cpp │ │ ├── Bellman-Ford_检测负权回路.cpp │ │ ├── Bellman-Ford_解决负权边_单源最短路.cpp │ │ ├── Dijkstra算法_单源最短路.cpp │ │ ├── Dijkstra算法(邻接矩阵) │ │ ├── Kruskal算法_最小生成树.cpp │ │ ├── Prim算法_最小生成树.cpp │ │ └── floyd算法_任意两点间最短路.cpp │ └── lec08final │ │ ├── A.cpp │ │ ├── A2.cpp │ │ ├── B.cpp │ │ ├── B2.cpp │ │ ├── C.cpp │ │ ├── D.cpp │ │ ├── E.cpp │ │ ├── E2.cpp │ │ ├── F.cpp │ │ ├── F2.cpp │ │ ├── G.cpp │ │ ├── H.cpp │ │ ├── I.cpp │ │ └── J.cpp ├── AHCPC │ ├── 2010 │ │ ├── A.cpp │ │ ├── A2.cpp │ │ ├── A3.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── C2.cpp │ │ └── D.cpp │ ├── 2011 │ │ ├── E.java │ │ ├── F.cpp │ │ ├── H.cpp │ │ └── I.cpp │ ├── 2012 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── D.cpp │ │ ├── E.cpp │ │ ├── F.cpp │ │ ├── G.cpp │ │ ├── H.cpp │ │ ├── I1.cpp │ │ ├── I2.cpp │ │ └── J.cpp │ ├── 2013 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── D.cpp │ │ ├── E.cpp │ │ ├── F.cpp │ │ ├── G.cpp │ │ ├── H.cpp │ │ ├── I.cpp │ │ ├── J.cpp │ │ └── K.cpp │ ├── 2014 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── D.cpp │ │ └── F.cpp │ ├── 2015 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── D.cpp │ │ ├── F.cpp │ │ ├── G.cpp │ │ ├── H.cpp │ │ ├── I.cpp │ │ └── J.cpp │ ├── 2016 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── D.cpp │ │ ├── e.cpp │ │ ├── f.cpp │ │ ├── g.cpp │ │ ├── h.cpp │ │ └── i.cpp │ ├── 2017 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── E.cpp │ │ └── F.cpp │ ├── 2018 │ │ ├── A.cpp │ │ ├── A2.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── C2.cpp │ │ ├── D 判重.cpp │ │ ├── D.cpp │ │ ├── E.cpp │ │ ├── F.cpp │ │ ├── G2.cpp │ │ ├── H.cpp │ │ ├── I.cpp │ │ ├── J.cpp │ │ └── K.cpp │ ├── 2019 │ │ ├── A_机器人足球.cpp │ │ ├── B_纸牌识别.cpp │ │ ├── C_卡牌对决.cpp │ │ ├── D.cpp │ │ ├── E.cpp │ │ ├── F.cpp │ │ ├── G.cpp │ │ ├── H.cpp │ │ ├── I.cpp │ │ ├── J.cpp │ │ ├── K_福报.cpp │ │ ├── L_曲奇工厂.cpp │ │ ├── _A.cpp │ │ └── _A2.cpp │ └── 2020Sep │ │ ├── read.md │ │ ├── 三角形计数.cpp │ │ ├── 判断和.cpp │ │ ├── 开心消消乐.cpp │ │ ├── 简单计数.cpp │ │ ├── 英雄打怪兽.cpp │ │ ├── 苹果树.cpp │ │ ├── 韭菜国大选.cpp │ │ └── 韭菜国数据结构习题.cpp ├── CCPC │ ├── 2019CCPCwfinal │ │ ├── ATicket.cpp │ │ ├── BGcd.cpp │ │ ├── CFunction.cpp │ │ ├── DTree.cpp │ │ ├── ECheckout.cpp │ │ ├── FString.cpp │ │ ├── GString.cpp │ │ ├── HClock.cpp │ │ ├── IUnion.cpp │ │ ├── JTangram.cpp │ │ └── KTetris.cpp │ ├── CCPC2016hefei │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── D.cpp │ │ ├── E.cpp │ │ ├── G.cpp │ │ ├── H.cpp │ │ ├── I.cpp │ │ └── J.cpp │ └── CCPC2018 │ │ ├── 1000.cpp │ │ ├── 1004.cpp │ │ ├── 1010.cpp │ │ └── 1010.txt ├── Contests │ ├── baiduStar2018 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── B.txt │ │ ├── B2.cpp │ │ ├── B2.txt │ │ ├── C.cpp │ │ ├── C.txt │ │ └── CAC.java │ ├── baiduStar2018B │ │ ├── A.cpp │ │ ├── A.in │ │ ├── B.cpp │ │ ├── B.in │ │ ├── C.cpp │ │ ├── C.in │ │ ├── D.cpp │ │ ├── D.in │ │ ├── E.cpp │ │ ├── E.in │ │ ├── F.cpp │ │ ├── F.in │ │ ├── G.cpp │ │ └── G.in │ └── nowcoder201807monthly │ │ ├── A.cpp │ │ ├── B.cpp │ │ └── C.cpp └── 代码模板库 │ ├── 0-一切的开始.md │ ├── 1-数据结构.md │ ├── 2-数学.md │ ├── 3-图论.md │ ├── 4-计算几何.md │ ├── 5-字符串.md │ ├── 6-杂项.md │ ├── Algorithm │ ├── Convex_Hull.cpp │ ├── DSU_On_Tree(General).cpp │ ├── DSU_On_Tree(Rough).cpp │ ├── MCMF.cpp │ ├── Max_Flow.cpp │ └── Multiply_LCA.cpp │ ├── BOOKS │ ├── README.md │ ├── books.aHaAlgorithm │ │ ├── 1581.cpp │ │ ├── 1582.cpp │ │ ├── 1583.cpp │ │ ├── 1584.cpp │ │ ├── 1585.cpp │ │ ├── 1586.cpp │ │ ├── 1587.cpp │ │ ├── Bellman-Ford_检测负权回路.cpp │ │ ├── Bellman-Ford_解决负权边_单源最短路.cpp │ │ ├── Dijkstra算法_单源最短路.cpp │ │ ├── Dijkstra算法(邻接矩阵) │ │ ├── Kruskal算法_最小生成树.cpp │ │ ├── Prim算法_最小生成树.cpp │ │ ├── bubble_sort.cpp │ │ ├── c0101BucketSort.py │ │ ├── c0102BubbleSort.py │ │ ├── c0103QuickSort.py │ │ ├── c0104SelectionSort.py │ │ ├── c0105InsertionSort.py │ │ ├── c0106MergSort.py │ │ ├── comments.MD │ │ ├── dfs_迷宫.cpp │ │ ├── floyd算法_任意两点间最短路.cpp │ │ ├── n的全排列.cpp │ │ ├── quick_sort.cpp │ │ ├── quick_sort2.cpp │ │ ├── 回文串.cpp │ │ ├── 并查集.cpp │ │ └── 解密QQ号.cpp │ ├── chapter02AlgorithmComplexity │ │ ├── ALDS0101DMaximumProfit.cpp │ │ ├── ALDS0101DMaximumProfit2.cpp │ │ ├── ALDS0101DMaximumProfit3.cpp │ │ ├── Ex0202Top3A.cpp │ │ ├── Ex0202Top3B.cpp │ │ └── Ex0202Top3C.cpp │ ├── chapter03BasicSortingAlgorithms │ │ ├── ALDS0101AInsertionSort.cpp │ │ ├── ALDS0102ABubbleSort.cpp │ │ └── ALDS0102BSelectionSort.cpp │ ├── part01-language │ │ ├── ch01 │ │ │ ├── example0101.cpp │ │ │ ├── example0102.cpp │ │ │ ├── example0103.cpp │ │ │ ├── example0104.cpp │ │ │ ├── example0105.cpp │ │ │ ├── example0106.cpp │ │ │ ├── example0107.cpp │ │ │ ├── example0108.cpp │ │ │ ├── example0109.cpp │ │ │ ├── example0110.cpp │ │ │ ├── example0111.cpp │ │ │ ├── example0112.cpp │ │ │ └── sort3.in │ │ ├── ch02 │ │ │ ├── example0201.cpp │ │ │ ├── example0202.cpp │ │ │ ├── example0203.cpp │ │ │ └── example0204.cpp │ │ ├── ch03 │ │ │ ├── UVa10082.cpp │ │ │ ├── UVa1583.cpp │ │ │ ├── UVa1584.cpp │ │ │ ├── UVa272.cpp │ │ │ ├── UVa340.cpp │ │ │ ├── UVa401.cpp │ │ │ └── readme.md │ │ ├── ch04 │ │ │ ├── UVa12412.cpp │ │ │ ├── UVa133.cpp │ │ │ ├── UVa1339.cpp │ │ │ ├── UVa1339b.cpp │ │ │ ├── UVa489.cpp │ │ │ ├── UVa512a.cpp │ │ │ ├── UVa512b.cpp │ │ │ ├── comb-mingw.cpp │ │ │ ├── comb.cpp │ │ │ ├── fp.cpp │ │ │ ├── point.cpp │ │ │ ├── readme.md │ │ │ ├── sum.cpp │ │ │ ├── uva12412.ans │ │ │ ├── uva12412.in │ │ │ ├── uva12412_sample.ans │ │ │ ├── uva12412_sample.in │ │ │ ├── uva213.cpp │ │ │ ├── uva512.ans │ │ │ └── uva512.in │ │ └── ch05 │ │ │ ├── 5-1.cpp │ │ │ ├── 5-2.cpp │ │ │ ├── 5-3.cpp │ │ │ ├── BigInteger.cpp │ │ │ ├── UVa10815.cpp │ │ │ ├── UVa12096.ans │ │ │ ├── UVa12096.cpp │ │ │ ├── UVa12096.in │ │ │ ├── UVa156.cpp │ │ │ ├── UVa1592.cpp │ │ │ ├── UVa207.cpp │ │ │ ├── UVa400.cpp │ │ │ ├── point.cpp │ │ │ ├── point2.cpp │ │ │ ├── pq.cpp │ │ │ ├── readme.md │ │ │ ├── template.cpp │ │ │ ├── test_sstream.cpp │ │ │ ├── test_stl.cpp │ │ │ ├── uva101.cpp │ │ │ ├── uva10474.cpp │ │ │ ├── uva136.cpp │ │ │ ├── uva221.cpp │ │ │ ├── uva540.cpp │ │ │ └── uva814.cpp │ ├── part02-basic │ │ ├── ch6 │ │ │ ├── UVa10129.cpp │ │ │ ├── UVa10305.cpp │ │ │ ├── UVa10562.cpp │ │ │ ├── UVa1103.cpp │ │ │ ├── UVa11853.cpp │ │ │ ├── UVa12171.cpp │ │ │ ├── UVa122.cpp │ │ │ ├── UVa122b.cpp │ │ │ ├── UVa12657.cpp │ │ │ ├── UVa1572.cpp │ │ │ ├── UVa1599.cpp │ │ │ ├── UVa210.cpp │ │ │ ├── UVa297.cpp │ │ │ ├── UVa442.cpp │ │ │ ├── UVa514.cpp │ │ │ ├── UVa548.cpp │ │ │ ├── UVa572.cpp │ │ │ ├── UVa679.cpp │ │ │ ├── UVa699.cpp │ │ │ ├── UVa839.cpp │ │ │ ├── readme.md │ │ │ ├── uva11998.cpp │ │ │ ├── uva506.cpp │ │ │ └── uva816.cpp │ │ └── ch7 │ │ │ ├── 8.cpp │ │ │ ├── 8a.in │ │ │ ├── 8b.cpp │ │ │ ├── 8b.in │ │ │ ├── 8c.cpp │ │ │ ├── UVa10603.ans │ │ │ ├── UVa10603.cpp │ │ │ ├── UVa10603.in │ │ │ ├── UVa10976.cpp │ │ │ ├── UVa11059.cpp │ │ │ ├── UVa11212.cpp │ │ │ ├── UVa12325.cpp │ │ │ ├── UVa129.cpp │ │ │ ├── UVa1343.cpp │ │ │ ├── UVa1354.cpp │ │ │ ├── UVa1374.cpp │ │ │ ├── UVa140.cpp │ │ │ ├── UVa1601.cpp │ │ │ ├── UVa1602.cpp │ │ │ ├── UVa1603.cpp │ │ │ ├── UVa524.cpp │ │ │ ├── UVa725.cpp │ │ │ ├── egypt.cpp │ │ │ ├── nqueen.cpp │ │ │ ├── nqueen2.cpp │ │ │ ├── nqueen_slow.cpp │ │ │ ├── p1603.ans │ │ │ ├── p1603.in │ │ │ ├── pp.cpp │ │ │ ├── pp2.cpp │ │ │ ├── pp3.cpp │ │ │ ├── readme.md │ │ │ ├── subset.cpp │ │ │ ├── subset2.cpp │ │ │ └── subset3.cpp │ └── part03-contest │ │ ├── ch10 │ │ ├── UVa10213.cpp │ │ ├── UVa10214.cpp │ │ ├── UVa10288.ans │ │ ├── UVa10288.cpp │ │ ├── UVa10288.in │ │ ├── UVa10375.cpp │ │ ├── UVa10791.cpp │ │ ├── UVa10820.cpp │ │ ├── UVa10900.cpp │ │ ├── UVa11440.ans │ │ ├── UVa11440.cpp │ │ ├── UVa11440.in │ │ ├── UVa11582.cpp │ │ ├── UVa11971.cpp │ │ ├── UVa12034.cpp │ │ ├── UVa12169.cpp │ │ ├── UVa1262.cpp │ │ ├── UVa12716.cpp │ │ ├── UVa1363.cpp │ │ ├── UVa1635.cpp │ │ ├── UVa1636.cpp │ │ ├── UVa1637.cpp │ │ ├── UVa1638.cpp │ │ ├── UVa1639.cpp │ │ ├── UVa1640.cpp │ │ ├── UVa1641.cpp │ │ ├── UVa1642.cpp │ │ ├── UVa580.cpp │ │ ├── readme.md │ │ ├── uva10491.cpp │ │ ├── uva11181.cpp │ │ ├── uva11346.cpp │ │ ├── uva12230.cpp │ │ └── uva1393.cpp │ │ ├── ch11 │ │ ├── UVa10048.cpp │ │ ├── UVa10735.cpp │ │ ├── UVa11082.cpp │ │ ├── UVa1151.cpp │ │ ├── UVa12219.cpp │ │ ├── UVa1279.cpp │ │ ├── UVa1349.cpp │ │ ├── UVa1395.cpp │ │ ├── UVa1515.cpp │ │ ├── UVa1658.cpp │ │ ├── UVa1659.cpp │ │ ├── UVa247.cpp │ │ ├── UVa658.cpp │ │ ├── UVa753.cpp │ │ ├── UVa753b.cpp │ │ └── readme.md │ │ ├── ch12 │ │ ├── UVa12538_rope.cpp │ │ ├── UVa1671.cpp │ │ ├── UVa1673.cpp │ │ ├── readme.md │ │ └── uva1672.cpp │ │ ├── ch8 │ │ ├── UVa10954.cpp │ │ ├── UVa11054.cpp │ │ ├── UVa11093.cpp │ │ ├── UVa11134.cpp │ │ ├── UVa1152.cpp │ │ ├── UVa11572.cpp │ │ ├── UVa11572b.cpp │ │ ├── UVa11572c.cpp │ │ ├── UVa120.cpp │ │ ├── UVa12174.cpp │ │ ├── UVa12265.cpp │ │ ├── UVa12627.cpp │ │ ├── UVa1451.cpp │ │ ├── UVa1471.cpp │ │ ├── UVa1605.cpp │ │ ├── UVa1606.cpp │ │ ├── UVa1607.cpp │ │ ├── UVa1608.cpp │ │ ├── UVa1609.cpp │ │ ├── UVa714.cpp │ │ ├── readme.md │ │ └── uva1442.cpp │ │ └── ch9 │ │ ├── UVa10003.cpp │ │ ├── UVa10559.cpp │ │ ├── UVa10618.in │ │ ├── UVa10934.cpp │ │ ├── UVa11584.cpp │ │ ├── UVa116.cpp │ │ ├── UVa1204.cpp │ │ ├── UVa12099.cpp │ │ ├── UVa12105.cpp │ │ ├── UVa1220.cpp │ │ ├── UVa1228.cpp │ │ ├── UVa1252.cpp │ │ ├── UVa12563.cpp │ │ ├── UVa1331.cpp │ │ ├── UVa1336.cpp │ │ ├── UVa1439.cpp │ │ ├── UVa1625.cpp │ │ ├── UVa1626.cpp │ │ ├── UVa1626slow.cpp │ │ ├── UVa1627.cpp │ │ ├── UVa1628.cpp │ │ ├── UVa437.cpp │ │ ├── readme.md │ │ ├── uva1025.cpp │ │ ├── uva10618.ans │ │ ├── uva10618.cpp │ │ ├── uva10817.cpp │ │ ├── uva11400.cpp │ │ ├── uva12170.cpp │ │ ├── uva1218.cpp │ │ ├── uva12186.cpp │ │ ├── uva1347.cpp │ │ ├── uva1375.cpp │ │ ├── uva1380.cpp │ │ ├── uva1412.ans │ │ ├── uva1412.cpp │ │ ├── uva1412.in │ │ └── uva1412slow.cpp │ ├── Data_Structure │ ├── 01Trie.cpp │ ├── AFL(Cactus).cpp │ ├── Cartesian_Tree.cpp │ ├── Chairman_Tree.cpp │ ├── KD_Tree.cpp │ ├── Segment_Tree(Dynamic_Memory).cpp │ └── Segment_Tree.cpp │ ├── Graph │ ├── Dijkstra.cpp │ ├── Tarjan(BCC_Edge).cpp │ ├── Tarjan(BCC_Point).cpp │ ├── Tarjan(SCC).cpp │ └── Tree │ │ ├── Heavy_Light_Decomposition.cpp │ │ ├── Point-Divide&Conquer.cpp │ │ └── Virtual_Tree.cpp │ ├── Math │ ├── BerlekampMassey.cpp │ ├── CRT.cpp │ ├── FFT.cpp │ ├── FWT.cpp │ ├── Matrix.cpp │ ├── Mobius.cpp │ └── linear_sieve.cpp │ ├── Others │ └── Header.cpp │ ├── README.md │ ├── String │ ├── Automaton │ │ ├── Aho-Corasick_Automaton.cpp │ │ ├── Generalized_Suffix_Automaton.cpp │ │ ├── Palindromic_Automaton.cpp │ │ └── Suffix_Automaton.cpp │ ├── Hash-1D.cpp │ ├── KMP.cpp │ ├── Manacher.cpp │ └── Suffix_Array.cpp │ ├── WF-Team-Reference-Document.pdf │ ├── sam.png │ └── template.pdf ├── CMakeLists.txt ├── CppSTL ├── P65.txt ├── algorithm │ ├── all_of_any_of_none_of.cpp │ ├── copy_if.cpp │ ├── find_if_not.cpp │ ├── iota.cpp │ ├── is_sorted.cpp │ ├── minmax_element.cpp │ └── nth_element.cpp ├── cppstdlib │ ├── README │ ├── algo │ │ ├── accumulate1.cpp │ │ ├── adjacentdiff1.cpp │ │ ├── adjacentfind1.cpp │ │ ├── algostuff.hpp │ │ ├── allanynone1.cpp │ │ ├── binarysearch1.cpp │ │ ├── bounds1.cpp │ │ ├── copy1.cpp │ │ ├── copy2.cpp │ │ ├── copy3.cpp │ │ ├── count1.cpp │ │ ├── equal1.cpp │ │ ├── equalrange1.cpp │ │ ├── fill1.cpp │ │ ├── find1.cpp │ │ ├── find2.cpp │ │ ├── findend1.cpp │ │ ├── findof1.cpp │ │ ├── foreach1.cpp │ │ ├── foreach2.cpp │ │ ├── foreach3.cpp │ │ ├── generate1.cpp │ │ ├── heap1.cpp │ │ ├── includes1.cpp │ │ ├── innerproduct1.cpp │ │ ├── inplacemerge1.cpp │ │ ├── iota1.cpp │ │ ├── isheap1.cpp │ │ ├── ispartitioned1.cpp │ │ ├── ispermutation1.cpp │ │ ├── issorted1.cpp │ │ ├── lexicocmp1.cpp │ │ ├── merge1.cpp │ │ ├── minmax1.cpp │ │ ├── mismatch1.cpp │ │ ├── move1.cpp │ │ ├── nthelement1.cpp │ │ ├── partialsort1.cpp │ │ ├── partialsort2.cpp │ │ ├── partialsum1.cpp │ │ ├── partition1.cpp │ │ ├── partitioncopy1.cpp │ │ ├── permutation1.cpp │ │ ├── randomshuffle1.cpp │ │ ├── relabs1.cpp │ │ ├── remove1.cpp │ │ ├── remove2.cpp │ │ ├── replace1.cpp │ │ ├── replace2.cpp │ │ ├── reverse1.cpp │ │ ├── rotate1.cpp │ │ ├── rotate2.cpp │ │ ├── search1.cpp │ │ ├── search2.cpp │ │ ├── searchn1.cpp │ │ ├── shuffle1.cpp │ │ ├── sort1.cpp │ │ ├── sort2.cpp │ │ ├── sorted1.cpp │ │ ├── swapranges1.cpp │ │ ├── transform1.cpp │ │ ├── transform2.cpp │ │ ├── unique1.cpp │ │ ├── unique2.cpp │ │ └── unique3.cpp │ ├── alloc │ │ ├── myalloc03.cpp │ │ ├── myalloc03.hpp │ │ ├── myalloc11.cpp │ │ └── myalloc11.hpp │ ├── concurrency │ │ ├── async1.cpp │ │ ├── async2.cpp │ │ ├── async3.cpp │ │ ├── atomics1.cpp │ │ ├── condvar1.cpp │ │ ├── condvar2.cpp │ │ ├── mutex1.cpp │ │ ├── promise1.cpp │ │ ├── sharedfuture1.cpp │ │ └── thread1.cpp │ ├── cont │ │ ├── array1.cpp │ │ ├── buckets.hpp │ │ ├── cstylearray1.cpp │ │ ├── cstylearray1old.cpp │ │ ├── deque1.cpp │ │ ├── findbefore.hpp │ │ ├── forwardlist1.cpp │ │ ├── forwardlistfind1.cpp │ │ ├── forwardlistsplice1.cpp │ │ ├── hashfunc1.cpp │ │ ├── hashfunc2.cpp │ │ ├── hashval.hpp │ │ ├── list1.cpp │ │ ├── map1.cpp │ │ ├── map2.cpp │ │ ├── mapcmp1.cpp │ │ ├── mapfind1.cpp │ │ ├── multimap1.cpp │ │ ├── multiset1.cpp │ │ ├── newkey.hpp │ │ ├── print.hpp │ │ ├── refsem1.cpp │ │ ├── refwrap1.cpp │ │ ├── set1.cpp │ │ ├── setcmp1.cpp │ │ ├── setrange1.cpp │ │ ├── sortset.cpp │ │ ├── sortvec.cpp │ │ ├── unordinspect1.cpp │ │ ├── unordmultimap1.cpp │ │ ├── unordmultiset1.cpp │ │ ├── unordset1.cpp │ │ └── vector1.cpp │ ├── contadapt │ │ ├── Queue.hpp │ │ ├── Stack.hpp │ │ ├── bitset1.cpp │ │ ├── bitset2.cpp │ │ ├── priorityqueue1.cpp │ │ ├── queue1.cpp │ │ ├── queue2.cpp │ │ ├── stack1.cpp │ │ └── stack2.cpp │ ├── fo │ │ ├── bind1.cpp │ │ ├── bind2.cpp │ │ ├── compose3.cpp │ │ ├── fopow.hpp │ │ ├── fopow1.cpp │ │ ├── foreach3.cpp │ │ ├── lambda2.cpp │ │ ├── lambda3.cpp │ │ ├── lambda4.cpp │ │ ├── lambda5.cpp │ │ ├── lambda6.cpp │ │ ├── print.hpp │ │ ├── removeif1.cpp │ │ ├── sequence1.cpp │ │ ├── sequence2.cpp │ │ └── sort1.cpp │ ├── i18n │ │ ├── germanbool.cpp │ │ ├── loc1.cpp │ │ ├── loc2.cpp │ │ ├── moneymanipulator.cpp │ │ ├── moneypunct.cpp │ │ ├── numget.cpp │ │ ├── numput.cpp │ │ ├── timeget.cpp │ │ ├── timeput.cpp │ │ ├── wbuffer.cpp │ │ ├── wstring2string.cpp │ │ ├── wstring2string.hpp │ │ ├── wstring2utf8.cpp │ │ └── wstring2utf8.hpp │ ├── io │ │ ├── cat1.cpp │ │ ├── cat2.cpp │ │ ├── charcat1.cpp │ │ ├── charcat2.cpp │ │ ├── copy1.cpp │ │ ├── copy2.cpp │ │ ├── countlines1.cpp │ │ ├── frac1in.hpp │ │ ├── frac1out.hpp │ │ ├── frac2in.hpp │ │ ├── frac2out.hpp │ │ ├── fstream1.cpp │ │ ├── fstream2.cpp │ │ ├── ignore1.cpp │ │ ├── ignore1.hpp │ │ ├── ignore2.cpp │ │ ├── ignore2.hpp │ │ ├── inbuf1.cpp │ │ ├── inbuf1.hpp │ │ ├── io1.cpp │ │ ├── outbuf1.cpp │ │ ├── outbuf1.hpp │ │ ├── outbuf1i18n.cpp │ │ ├── outbuf1i18n.hpp │ │ ├── outbuf2.cpp │ │ ├── outbuf2.hpp │ │ ├── outbuf3.cpp │ │ ├── outbuf3.hpp │ │ ├── sstream1.cpp │ │ ├── sstream2.cpp │ │ ├── streambuffer1.cpp │ │ ├── streambuffer2.cpp │ │ ├── streamreadwrite1.cpp │ │ ├── streamredirect1.cpp │ │ ├── sum1.cpp │ │ ├── sum2.cpp │ │ └── timemanipulator1.cpp │ ├── iter │ │ ├── advance1.cpp │ │ ├── advance2.cpp │ │ ├── assoiter.hpp │ │ ├── assoiter1.cpp │ │ ├── backinserter1.cpp │ │ ├── distance1.cpp │ │ ├── frontinserter1.cpp │ │ ├── inserter1.cpp │ │ ├── istreamiter1.cpp │ │ ├── itercategory1.cpp │ │ ├── iterswap1.cpp │ │ ├── ostreamiter1.cpp │ │ ├── print.hpp │ │ ├── reviter1.cpp │ │ ├── reviter2.cpp │ │ ├── reviter3.cpp │ │ └── reviter4.cpp │ ├── lang │ │ └── lambda1.cpp │ ├── num │ │ ├── complex1.cpp │ │ ├── complex2.cpp │ │ ├── dist1.cpp │ │ ├── gslice1.cpp │ │ ├── indirectarray1.cpp │ │ ├── maskarray1.cpp │ │ ├── random1.cpp │ │ ├── random2.cpp │ │ ├── slice1.cpp │ │ ├── valarray1.cpp │ │ └── valarray2.cpp │ ├── regex │ │ ├── regex1.cpp │ │ ├── regex2.cpp │ │ ├── regex3.cpp │ │ ├── regex4.cpp │ │ ├── regex5.cpp │ │ ├── regexexception.hpp │ │ ├── regexiter1.cpp │ │ └── regextokeniter1.cpp │ ├── stl │ │ ├── add1.cpp │ │ ├── algo1.cpp │ │ ├── algo1old.cpp │ │ ├── array1.cpp │ │ ├── assoarray1.cpp │ │ ├── bind1.cpp │ │ ├── copy1.cpp │ │ ├── copy2.cpp │ │ ├── copybug.cpp │ │ ├── deque1.cpp │ │ ├── find1.cpp │ │ ├── fo1.cpp │ │ ├── foreach1.cpp │ │ ├── foreach2.cpp │ │ ├── forwardlist1.cpp │ │ ├── ioiter1.cpp │ │ ├── iterbug.cpp │ │ ├── lambda1.cpp │ │ ├── list1.cpp │ │ ├── list1old.cpp │ │ ├── list2.cpp │ │ ├── multimap1.cpp │ │ ├── multiset1.cpp │ │ ├── prime1.cpp │ │ ├── print.hpp │ │ ├── remove1.cpp │ │ ├── remove2.cpp │ │ ├── remove3.cpp │ │ ├── remove4.cpp │ │ ├── reviter1.cpp │ │ ├── set1.cpp │ │ ├── sort1.cpp │ │ ├── sort2.cpp │ │ ├── transform1.cpp │ │ ├── unordmap1.cpp │ │ ├── unordmultiset1.cpp │ │ ├── unordmultiset2.cpp │ │ └── vector1.cpp │ ├── string │ │ ├── icstring.hpp │ │ ├── icstring1.cpp │ │ ├── string1.cpp │ │ ├── string2.cpp │ │ ├── string3.cpp │ │ ├── stringiter1.cpp │ │ ├── stringiter2.cpp │ │ └── stringnumconv1.cpp │ └── util │ │ ├── chrono1.cpp │ │ ├── chrono2.cpp │ │ ├── clock.hpp │ │ ├── clock1.cpp │ │ ├── enableshared1.cpp │ │ ├── exception.hpp │ │ ├── limits1.cpp │ │ ├── minmax1.cpp │ │ ├── pair1.cpp │ │ ├── printtuple.hpp │ │ ├── ratio1.cpp │ │ ├── sharedptr1.cpp │ │ ├── sharedptr2.cpp │ │ ├── sharedptr3.cpp │ │ ├── timepoint.hpp │ │ ├── timepoint1.cpp │ │ ├── tuple1.cpp │ │ ├── tuple2.cpp │ │ ├── uniqueptr1.cpp │ │ ├── weakptr1.cpp │ │ └── weakptr2.cpp ├── cxx11.cpp ├── math │ └── 本原立方勾股数.cpp ├── multimap.cpp ├── multiset.cpp ├── p20.txt ├── priority_queue.cpp ├── rmq.cpp ├── sstreamDemo.cpp ├── stl2.cpp ├── testCPU.cpp ├── topological_sort.cpp └── unordered_set.cpp ├── JAL ├── PAT │ ├── Advanced │ │ ├── 1001.cpp │ │ ├── 1001b.cpp │ │ ├── 1002.cpp │ │ ├── 1002b.cpp │ │ ├── 1003.cpp │ │ ├── 1004.cpp │ │ ├── 1005.cpp │ │ ├── 1006.cpp │ │ ├── 1006b.cpp │ │ ├── 1007.cpp │ │ ├── 1008.cpp │ │ ├── 1009.cpp │ │ ├── 1010.cpp │ │ ├── 1010b.cpp │ │ ├── 1011.cpp │ │ ├── 1012.cpp │ │ ├── 1013.cpp │ │ ├── 1014.cpp │ │ ├── 1015.cpp │ │ ├── 1016(WA).cpp │ │ ├── 1017.cpp │ │ ├── 1019.cpp │ │ ├── 1020.cpp │ │ ├── 1021.cpp │ │ ├── 1022.cpp │ │ ├── 1023.cpp │ │ ├── 1024.cpp │ │ ├── 1025.cpp │ │ ├── 1026.cpp │ │ ├── 1027.cpp │ │ ├── 1028.cpp │ │ ├── 1029.cpp │ │ ├── 1030.cpp │ │ ├── 1031.cpp │ │ ├── 1032.cpp │ │ ├── 1033.cpp │ │ ├── 1034.cpp │ │ ├── 1035.cpp │ │ ├── 1036.cpp │ │ ├── 1037.cpp │ │ ├── 1038.cpp │ │ ├── 1039.cpp │ │ ├── 1040.cpp │ │ ├── 1041.cpp │ │ ├── 1042.cpp │ │ ├── 1043.cpp │ │ ├── 1044.cpp │ │ ├── 1045.cpp │ │ ├── 1046.cpp │ │ ├── 1047.cpp │ │ ├── 1048.cpp │ │ ├── 1049.cpp │ │ ├── 1050.cpp │ │ ├── 1051.cpp │ │ ├── 1052.cpp │ │ ├── 1053.cpp │ │ ├── 1054.cpp │ │ ├── 1055.cpp │ │ ├── 1056.cpp │ │ ├── 1057.cpp │ │ ├── 1058.cpp │ │ ├── 1059.cpp │ │ ├── 1060.cpp │ │ ├── 1061.cpp │ │ ├── 1062.cpp │ │ ├── 1063.cpp │ │ ├── 1064.cpp │ │ ├── 1065.cpp │ │ ├── 1066.cpp │ │ ├── 1067.cpp │ │ ├── 1068.cpp │ │ ├── 1069.cpp │ │ ├── 1070.cpp │ │ ├── 1071.cpp │ │ ├── 1072.cpp │ │ ├── 1073.cpp │ │ ├── 1074.cpp │ │ ├── 1075.cpp │ │ ├── 1076.cpp │ │ ├── 1077.cpp │ │ ├── 1078.cpp │ │ ├── 1079.cpp │ │ ├── 1080.cpp │ │ ├── 1081.cpp │ │ ├── 1082.cpp │ │ ├── 1083.cpp │ │ ├── 1084.cpp │ │ ├── 1085.cpp │ │ ├── 1086.cpp │ │ ├── 1087.cpp │ │ ├── 1088.cpp │ │ ├── 1089.cpp │ │ ├── 1090.cpp │ │ ├── 1091.cpp │ │ ├── 1092.cpp │ │ ├── 1093.cpp │ │ ├── 1094.cpp │ │ ├── 1095.cpp │ │ ├── 1096.cpp │ │ ├── 1097.cpp │ │ ├── 1098.cpp │ │ ├── 1099.cpp │ │ ├── 1100.cpp │ │ ├── 1101.cpp │ │ ├── 1102.cpp │ │ ├── 1103.cpp │ │ ├── 1104.cpp │ │ ├── 1105.cpp │ │ ├── 1107.cpp │ │ ├── 1111.cpp │ │ ├── 1115.cpp │ │ ├── 1119.cpp │ │ ├── 1123.cpp │ │ ├── Contest2019 │ │ │ ├── A.cpp │ │ │ ├── B.cpp │ │ │ ├── C.cpp │ │ │ └── D.cpp │ │ ├── input.txt │ │ └── test.cpp │ ├── Medium │ │ ├── 1001.cpp │ │ ├── 1001b.cpp │ │ ├── 1002.cpp │ │ ├── 1002b.cpp │ │ ├── 1003.cpp │ │ ├── 1003b.cpp │ │ ├── 1004.cpp │ │ ├── 1005.cpp │ │ ├── 1007.cpp │ │ ├── 1011.cpp │ │ ├── 1012.cpp │ │ ├── 1013.cpp │ │ ├── 1015.cpp │ │ ├── 1016.cpp │ │ ├── 1017.cpp │ │ ├── 1018.cpp │ │ ├── 1019.cpp │ │ ├── 1021.cpp │ │ ├── 1022.cpp │ │ ├── 1023.cpp │ │ ├── 1025.cpp │ │ ├── 1028.cpp │ │ ├── 1029.cpp │ │ ├── 1030.cpp │ │ ├── 1031.cpp │ │ ├── 1034.cpp │ │ ├── 1036.cpp │ │ ├── 1037.cpp │ │ ├── 1038.cpp │ │ ├── 1039.cpp │ │ ├── 1040.cpp │ │ ├── 1040b.cpp │ │ ├── 1042.cpp │ │ ├── 1043.cpp │ │ ├── 1044.cpp │ │ ├── 1046.cpp │ │ ├── 1047.cpp │ │ ├── 1086.cpp │ │ ├── 1087.cpp │ │ ├── 1091.cpp │ │ ├── 1093.cpp │ │ ├── 1094.cpp │ │ ├── 1206.cpp │ │ └── input.txt │ ├── Other │ │ ├── 1001.cpp │ │ ├── 1001b.cpp │ │ ├── 1002.cpp │ │ ├── Z02.cpp │ │ └── sstreamDemo.cpp │ └── zc0263.cpp ├── beike │ ├── A多米诺骨牌.cpp │ ├── B计算器.cpp │ └── C家族关系.cpp ├── jd │ ├── A寻找中位数.cpp │ └── B修路.cpp ├── usaco │ ├── 2862.cpp │ ├── 2863.cpp │ ├── 2864.cpp │ ├── 2867.cpp │ ├── 2868.cpp │ ├── 2869.cpp │ ├── 2870.cpp │ ├── 2871.cpp │ ├── P1200.cc │ ├── P1201.cc │ ├── P1202.cc │ ├── P1203.cc │ ├── P1204.cc │ ├── P1204brute.cc │ ├── P1205.cc │ └── readme.md └── wangyi │ ├── formal │ ├── A橡皮泥捏斑马.cpp │ ├── B买房.cpp │ └── C社团主席选举.cpp │ └── test │ ├── A俄罗斯方块.cpp │ ├── B瞌睡.cpp │ └── C丰收.cpp ├── LICENSE ├── NOIP ├── NOIP2000 │ ├── A_P1017_进制转化.cpp │ ├── B_P1018_乘积最大.java │ ├── C_P1019_单词接龙.cpp │ ├── D_P1023_税收和补贴.cpp │ └── outline.md ├── NOIP2001 │ └── outline.md ├── NOIP2002 │ └── outline.md ├── NOIP2003 │ └── outline.md ├── NOIP2004 │ └── outline.md ├── NOIP2005 │ └── outline.md ├── NOIP2006 │ └── outline.md ├── NOIP2007 │ └── outline.md ├── NOIP2008 │ └── outline.md ├── NOIP2009 │ └── outline.md ├── NOIP2010 │ └── outline.md ├── NOIP2011 │ └── outline.md ├── NOIP2012 │ └── outline.md ├── NOIP2013 │ └── outline.md ├── NOIP2014 │ └── outline.md ├── NOIP2015 │ └── outline.md ├── NOIP2016 │ └── outline.md ├── NOIP2017 │ ├── A_P3951_小凯的疑惑.cpp │ └── outline.md ├── P1000超级马里奥.cpp ├── P1001A+B.cpp ├── P1009阶乘之和.cpp ├── P1019单词接龙.cpp ├── P1024一元三次方程.cc ├── P1024一元三次方程b.cc ├── P1421.cpp ├── P1422.cpp ├── ccf认证 │ ├── Calculator-bobo.cpp │ ├── ISBN.cpp │ ├── ISBN号码.cpp │ ├── URL映射.cpp │ ├── 公共钥匙盒.cpp │ ├── 出现次数最多的数.cpp │ ├── 分蛋糕.cpp │ ├── 图像旋转.cpp │ ├── 学生排队.cpp │ ├── 小球碰撞.cpp │ ├── 打酱油.cpp │ ├── 最小差值.cpp │ ├── 游戏.cpp │ ├── 画图.cpp │ ├── 相反数.cpp │ ├── 相邻数对.cpp │ ├── 窗口.cpp │ ├── 跳一跳.cpp │ └── 门禁系统.cpp ├── input.txt ├── oj.noi.cn │ ├── 100000连续和.cpp │ ├── 1000012二叉树计数_递推.cpp │ ├── 1000013二维前缀和.cpp │ ├── 100003.cpp │ ├── 100005WA.cpp │ ├── 100005_super_string_fibonacci.cpp │ ├── 100006组合递推.cpp │ ├── 100007.cpp │ ├── 100009奶牛.cpp │ ├── 100010N个人比赛排名_递推.cpp │ ├── 100011旅行_全错排公式.cpp │ ├── 1001F2C.cpp │ ├── 1002TriangleArea.cpp │ ├── 1003GuessNumber.cpp │ ├── 1004FillRectangles.cpp │ ├── 1005SavingIncome.cpp │ ├── 1006Pick20Stone.cpp │ ├── 1007FloatMod.cpp │ ├── 1008Daffodil2.cpp │ ├── 1008daffodil.cpp │ ├── 1009AssignMission.cpp │ ├── 1010PostPackage.cpp │ ├── 1011Square.cpp │ ├── 1012TransformCode.cpp │ ├── 1013CheckTriangle.cpp │ ├── 1014WriteComments.cpp │ ├── 1015WhatDay.cpp │ ├── 1016CountDays.cpp │ ├── 1017QueryPrice.cpp │ ├── 1018Telephone.cpp │ ├── 1019SegmentFunction.cpp │ ├── 1020RecognizeNumber.cpp │ ├── 1021PayBonus.cpp │ ├── 1022AverageAge.cpp │ ├── 1023MaxGap.cpp │ ├── 1024CountDivisors.cpp │ ├── 1025CountPrizes.cpp │ ├── 1026PerformanceRating.cpp │ ├── 1027SumDigits.cpp │ ├── 1028JudgeCoPrime.cpp │ ├── 1029EncyptInformation.cpp │ ├── 1029EncyptLetter.cpp │ ├── 1030JGGuess.cpp │ ├── 1031IsoscelesTriangle.cpp │ ├── 1032Diamond.cpp │ ├── 1033MultiplicationTable.cpp │ ├── 1034LastDigitOfaPowerb.cpp │ ├── 1035EnumRoot.cpp │ ├── 1036Dec2Bin.cpp │ ├── 1037GetChanges.cpp │ ├── 1038MissingCard.cpp │ ├── 1039Get2PowerN.cpp │ ├── 1040DivisionGame.cpp │ ├── 1041VolunteerSelection.cpp │ ├── 1042Scholarships.cpp │ ├── 1043RectangleDivided.cpp │ ├── 1043RectangleDividedAC.cpp │ ├── 1044NeareastElement.cpp │ ├── 1044NearestElementB.cpp │ ├── 1045SumOfElements.cpp │ ├── 1046PrintMatrix.cpp │ ├── 1047MatrixSaddlePoint.cpp │ ├── 1048CheckMatrix.cpp │ ├── 1049RotateMatrix.cpp │ ├── 1050MatrixMultiplyix.cpp │ ├── 1050_matrix_multiply.cpp │ ├── 1051GroupPhoto.cpp │ ├── 1052SelfNumber.cpp │ ├── 1053ComputeSimilarity.cpp │ ├── 1054Minesweeper.cpp │ ├── 1054_mine_sweeper.cpp │ ├── 1055排序_WA到吐血.cpp │ ├── 1056Expression.cpp │ ├── 1056_expression.cpp │ ├── 1057RockScissorPaper.cpp │ ├── 1057RockScissorPaperWA.cpp │ ├── 1058Expression2.cpp │ ├── 1058ShortestWord.cpp │ ├── 1059_string_expression_add.cpp │ ├── 1060SampleChecker.cpp │ ├── 1060WACheckSimilarity.cpp │ ├── 1061WifiPassword.cpp │ ├── 1062ManhattanDistance.cpp │ ├── 1063Binormial.cpp │ ├── 1064Fibonacci.cpp │ ├── 1065LeastCommonMultiplier.cpp │ ├── 1066PrimerPairs.cpp │ ├── 1067BestMatchMatrix.cpp │ ├── 1068ImageRotationChange.cpp │ ├── 1068RotateImage.cpp │ ├── 1069decomposition_factor.cpp │ ├── 1070HanoiTower.cpp │ ├── 1070_Tower_of_Hanoi.cpp │ ├── 1071PellSeries.cpp │ ├── 1072ClambStairs.cpp │ ├── 1073PlaceApples.cpp │ ├── 1073_addend_decomposition.cpp │ ├── 1074Power2Serires.cpp │ ├── 1074_decompose_power_binary.cpp │ ├── 1075FFunction.cpp │ ├── 1076_conversion_number_systems.cpp │ ├── 1077IntegerDecomposition.cpp │ ├── 1077_integer_split.cpp │ ├── 1078ElevatorFloyed.cpp │ ├── 1078_elevator.cpp │ ├── 1079ValidateIdentification.cpp │ ├── 1080PrintHistogram.cpp │ ├── 1082StringCycle_AC.cpp │ ├── 1082TLE.cpp │ ├── 1084MinString.cpp │ ├── 1085happyString.cpp │ ├── 1086TerribleString.cpp │ ├── 1087Kth.cpp │ ├── 1088_discretization.cpp │ ├── 1088离散化nlogn算法.cpp │ ├── 1088离散化平方算法.cpp │ ├── 1090CarsManagerment.cpp │ ├── 1091.GeometrymanagementOOP.cpp │ ├── 1092Riddle.cpp │ ├── 1092_riddle.cpp │ ├── 1093Rainbowcandy.cpp │ ├── 1093rainbow.cpp │ ├── 1094Stranger.cpp │ ├── 1095Shoping.cpp │ ├── 1096Score.cpp │ ├── 1098Forest_Fractions.cpp │ ├── 1099SetOperation.cpp │ ├── 1100FunctionApplication.cpp │ ├── 1101MatrixPrevSum.cpp │ ├── 1101_submatrix_sum.cpp │ ├── 1102MatrixOperation.cpp │ ├── 1102_swap_vector.cpp │ ├── 1103StringMinElements.cpp │ ├── 1103StringStableSort.cpp │ ├── 1103_string_max_operate.cpp │ ├── 1104WA.cpp │ ├── 1104_chemical_experiment.cpp │ ├── 1105InsertionSorting.cpp │ ├── 1105_insertion_sort.cpp │ ├── 1107_deque.cpp │ ├── 1109.cpp │ ├── 1109_maintain_sequence.cpp │ ├── 1110_A's_trouble.cpp │ ├── 1111队列.cpp │ ├── 1112ConnectionPieces.cpp │ ├── 1112_islands_connection_number.cpp │ ├── 1113BraceMatcher.cpp │ ├── 1114_rail_(out_stack).cpp │ ├── 1114可能的出栈序列.cpp │ ├── 1115FindNumber.cpp │ ├── 1115_last_less_or_equal_targert.cpp │ ├── 1116_min_maximum.cpp │ ├── 1116序列划分k组使得最大值最小.cpp │ ├── 1117Sorting.cpp │ ├── 1118KthMin.cpp │ ├── 1121RPorland.cpp │ ├── 1121ReversePorlandExpression.cpp │ ├── 1122_music_beat.cpp │ ├── 1123BinarySearcher.cpp │ ├── 1124Expression.cpp │ ├── 1125PolynomialMultiply.cpp │ ├── 1125PolynomialMultiplyTLE.cpp │ ├── 1127_family_(merge_find).cpp │ ├── 1127并查集集合版本.cpp │ ├── 1128_prefix_to_suffix.cpp │ ├── 1130_shortest_path.cpp │ ├── 1131士兵排队(贪心,二分枚举).cpp │ ├── 1133_back_white_cow.cpp │ ├── 1133黑白奶牛.cpp │ ├── 1136单词分类_字符串排序和集合.cpp │ ├── 1137_shoot.cpp │ ├── 1137射击_数组缓存二分查找.cpp │ ├── 1138BigIntegerAdd.cpp │ ├── 1140BigIntegerMul.cpp │ ├── 1141BigIntegerDivisionMod.cpp │ ├── 1142PrimerTestor.cpp │ ├── 1143垃圾炸弹_二位指定长度最大子矩阵.cpp │ ├── 1144MassiveNumber.cpp │ ├── 1145DigitPyramid.cpp │ ├── 1145_digit_gold_tower.cpp │ ├── 1146_longest_increasing_sub_sequence.cpp │ ├── 1146_longest_increasing_sub_sequence_2.cpp │ ├── 1147_longest_common_subsequence.cpp │ ├── 1149NQueens.cpp │ ├── 1149_N_queen.cpp │ ├── 1150_determine_base.cpp │ ├── 1151MaxSubSequence.cpp │ ├── 1151_array_maximun_constant_sum.cpp │ ├── 1152MaxSubMatrix.cpp │ ├── 1152_max_sub_matrix_sum.cpp │ ├── 1153PrimerCycleList.cpp │ ├── 1153_prime_circle.cpp │ ├── 1154BigIntegerSQRT.cpp │ ├── 1154_sqrt_BigInter_(binary_search).cpp │ ├── 1155AC.cpp │ ├── 1155TLE.cpp │ ├── 1155_KK's_assignment.cpp │ ├── 1156组合数计算_大数加法.cpp │ ├── 1157TLE.cpp │ ├── 1158Doss.cpp │ ├── 1158_dice.cpp │ ├── 1159_zero_one_pack_1.cpp │ ├── 1160_complete_pack_2.cpp │ ├── 1160完全背包问题.cpp │ ├── 1163渡河WA_待完善.cpp │ ├── 1163过河问题.cpp │ ├── 1164_cow_food_(dp).cpp │ ├── 1164奶牛零食_动态规划(逆向计算).cpp │ ├── 1165最大定长子矩阵.cpp │ ├── 1166TLE_DFS.cpp │ ├── 1167_maze.cpp │ ├── 1168_magic_cube_factory_(min_maximum).cpp │ ├── 1169_calculator.cpp │ ├── 1170IntegerPrimerComposition.cpp │ ├── 1171WA.cpp │ ├── 1171_方案数_(同数字金字塔,动态规划).cpp │ ├── 1171方案数_组合递推(扩展版本).cpp │ ├── 1172.cpp │ ├── 1172_word_number.cpp │ ├── 1173_pascal's_triangle.cpp │ ├── 1174_max_distance_(dfs).cpp │ ├── 1174最大深度dfs.cpp │ ├── 1175车站_组合数递推.cpp │ ├── 1176BigIntegerGCD.cpp │ ├── 1176_BigInteger_GCD.cpp │ ├── 1177_2dominoes_fibonacci.cpp │ ├── 1179StaggeredFormular.cpp │ ├── 1179StaggeredFormular2.cpp │ ├── 1179_wrong_line.cpp │ ├── 1180CountBinaryTree.cpp │ ├── 1180CountBinaryTrees.cpp │ ├── 1180_binary_tree_Catalan.cpp │ ├── 1181_out_stack_(Catelan).cpp │ ├── 1181出栈种类-卡特兰数.cpp │ ├── 1182_polygon_Catelan.cpp │ ├── 1183_add_brackets_(Catelan).cpp │ ├── 1184买票_卡特兰数应用.cpp │ ├── 1185IntegerDecompositionA.cpp │ ├── 1185_number_division_1.cpp │ ├── 1186_number_division_2.cpp │ ├── 1187_number_division_3.cpp │ ├── 1188_组合数_(递推至少三个连续的U的字符串的数量).cpp │ ├── 1188危险的组合.cpp │ ├── 1211EatingApple.cpp │ ├── 1212APowerBModC.cpp │ ├── 1213Fib.cpp │ ├── 1214maze.cpp │ ├── BigInteger.cpp │ ├── BigInteger_all_operator.cpp │ ├── CMakeLists.txt │ ├── LICENSE │ └── README.md └── tlxxx │ └── lec03-array2d │ ├── A.cpp │ ├── B.cpp │ ├── C.cpp │ ├── D.cpp │ ├── E.cpp │ ├── F.cpp │ ├── G.cpp │ ├── H.cpp │ └── I.cpp ├── OJ ├── acm.hdu.edu.cn │ ├── 1000.cpp │ ├── 1001.cpp │ ├── 1002.cpp │ ├── 1003b.cpp │ ├── 2018Multi-UniversityTrainingContest7 │ │ ├── A.cpp │ │ ├── A.in │ │ ├── B.cpp │ │ ├── B.in │ │ ├── C.cpp │ │ ├── C.in │ │ ├── D.cpp │ │ ├── D.in │ │ ├── E.cpp │ │ ├── E.in │ │ ├── F.cpp │ │ ├── F.in │ │ ├── G.cpp │ │ ├── G.in │ │ ├── H.cpp │ │ ├── H.in │ │ ├── I.cpp │ │ ├── I.in │ │ ├── J.cpp │ │ ├── J.in │ │ ├── K.cpp │ │ └── K.in │ ├── 2018multiUniversity01 │ │ ├── 1001.cc │ │ ├── 1002.cc │ │ ├── 1003.cc │ │ ├── 1003_spj.cc │ │ ├── 1004.cc │ │ ├── 1005.cc │ │ ├── 1006.cc │ │ ├── 1007.cc │ │ ├── 1008.cc │ │ ├── 1009.cc │ │ ├── 1010.cc │ │ ├── 1011.cc │ │ ├── A.cpp │ │ ├── A2.cpp │ │ ├── B.cpp │ │ ├── C.cpp │ │ ├── D.cpp │ │ ├── K.cpp │ │ └── multi-2018-solution.md │ ├── 2018multiUniversity02 │ │ ├── 1001.cpp │ │ ├── 1002.cpp │ │ ├── 1003.cpp │ │ ├── 1004.cpp │ │ ├── 1005.cpp │ │ ├── 1006.cpp │ │ ├── 1007.cpp │ │ ├── 1008.cpp │ │ ├── 1009.cpp │ │ ├── 1010.cpp │ │ ├── A.cpp │ │ ├── J.cpp │ │ └── test.cpp │ ├── 2018multiUniversity03 │ │ ├── 1006.cc │ │ ├── 1009.cc │ │ ├── 1012.cc │ │ ├── D.cc │ │ ├── ascendingrating.cpp │ │ ├── cutthestring.cpp │ │ ├── dynamicgraphmatching.cpp │ │ ├── eulerfunction.cpp │ │ ├── findthesubmatrix.cpp │ │ ├── grabthetree.cpp │ │ ├── input.txt │ │ ├── intertravel.cpp │ │ ├── monsterhunter.cpp │ │ ├── randomsequence.cpp │ │ ├── rectanglescanner.cpp │ │ ├── transportconstruction.cpp │ │ ├── visualcube.cpp │ │ └── walkingplan.cpp │ ├── 2018multiUniversity05 │ │ ├── 1008.cc │ │ └── input.txt │ ├── 6313.cpp │ └── data.in ├── acm.nyist.net │ ├── 0026.cpp │ ├── 0048.cpp │ ├── 0148.cpp │ ├── 01语言入门 │ │ ├── 0001.cpp │ │ ├── 0004.cpp │ │ ├── 0011.cpp │ │ ├── 0013.cpp │ │ ├── 0022.cpp │ │ ├── 0024.cpp │ │ ├── 0025.cpp │ │ ├── 0031.cpp │ │ ├── 0034.cpp │ │ ├── 0039.cpp │ │ ├── 0040.cpp │ │ ├── 0041.cpp │ │ ├── 0056.cpp │ │ ├── 0057.cpp │ │ ├── 0259.cpp │ │ ├── 0260.cpp │ │ ├── 0263.cpp │ │ └── 0264.cpp │ ├── 06STL练习 │ │ └── 0095.cpp │ ├── 1000.cpp │ ├── input.txt │ └── output.txt ├── acm.webturing.com │ └── 3100组成三位数.cpp ├── codeforces.com │ ├── 1141 │ │ ├── A.cpp │ │ ├── B.cpp │ │ ├── C_O(n).cpp │ │ ├── C_O(nlogn).cpp │ │ ├── D.cpp │ │ ├── E.cpp │ │ └── F1.cpp │ ├── 1169 │ │ ├── 1169A - Circle Metro.cpp │ │ ├── 1169B - Pairs.cpp │ │ ├── 1169C - Increasing by Modulo.cpp │ │ └── 1169D - Good Triple.cpp │ ├── 1003A - Polycarp's Pockets.cpp │ ├── 1005A - Tanya and Stairways.cpp │ ├── 1006A - Adjacent Replacements.cpp │ ├── 1015A - Points in Segments.cpp │ ├── 1017A - The Rank.cpp │ ├── 1095A - Repeating Cipher.cpp │ ├── 110A - Nearly Lucky Number.cpp │ ├── 112A - Petya and Strings.cpp │ ├── 114A - Cifera.cpp │ ├── 116A - Tram.cpp │ ├── 118A - String Task.cpp │ ├── 122A - Lucky Division.cpp │ ├── 122A.cpp │ ├── 131A - cAPS lOCK.cpp │ ├── 133A - HQ9+.cpp │ ├── 136A - Presents.cpp │ ├── 144A - Arrival of the General.cpp │ ├── 148A - Insomnia cure.cpp │ ├── 158A - Next Round.cpp │ ├── 158A.cpp │ ├── 158B - Taxi.cpp │ ├── 158B.cpp │ ├── 160A - Twins.cpp │ ├── 160A.cpp │ ├── 165A - Supercentral Point.cpp │ ├── 1A - Theatre Square.cpp │ ├── 208A - Dubstep.cpp │ ├── 231A - Team.cpp │ ├── 236A - Boy or Girl.cpp │ ├── 236A.cpp │ ├── 25A - IQ test.cpp │ ├── 263A - Beautiful Matrix.cpp │ ├── 266A - Stones on the Table.cpp │ ├── 266A.cpp │ ├── 266B - Queue at the School.cpp │ ├── 271A - Beautiful Year.cpp │ ├── 2812A - WordCapitalization.cpp │ ├── 282A - Bit++.cpp │ ├── 318A - Even Odds.cpp │ ├── 337A - Puzzles.cpp │ ├── 339A - Helpful Maths.cpp │ ├── 344A - Magnets_STLStack.cpp │ ├── 379A - New Year Candles .cpp │ ├── 405A Gravity Flip.cpp │ ├── 405A.cpp │ ├── 41A - Translation.cpp │ ├── 443A - Anton and Letters.cpp │ ├── 451A - Game With Sticks.cpp │ ├── 455A_SimpleDP.cpp │ ├── 466A - Cheap Travel.cpp │ ├── 467A - George and Accommodation.cpp │ ├── 469A - I Wanna Be the Guy .cpp │ ├── 479A - Expression.cpp │ ├── 496A - Minimum Difficulty_O(n^2).cpp │ ├── 496A - Minimum Difficulty_二分答案.cpp │ ├── 496A - Minimum Difficulty_线性算法.cpp │ ├── 4A - Watermelon.cpp │ ├── 4C - Registration System.cpp │ ├── 4D - Mysterious Present.cpp │ ├── 500A - New Year Transportation_Array.cpp │ ├── 500A.cpp │ ├── 50A - Domino piling.cpp │ ├── 520A - Pangram.cpp │ ├── 546A - Soldier and Bananas.cpp │ ├── 550A - Two Substrings.cpp │ ├── 580A - Kefa and First Steps.cpp │ ├── 58A - Chat room.cpp │ ├── 58A.cpp │ ├── 617A - Elephant.cpp │ ├── 61A - Ultra-Fast Mathematician.cpp │ ├── 69A - Young Physicist.cpp │ ├── 711A - Bus to Udayland.cpp │ ├── 71A - Way Too Long Words.cpp │ ├── 734A - Anton and Danik.cpp │ ├── 749A - Bachgold Problem.cpp │ ├── 82A - Double Cola_AC.cpp │ ├── 82A - Double Cola_Math.cpp │ ├── 82A - Double Cola_TLE.cpp │ ├── 835A - Key races.cpp │ ├── 96A - Football.cpp │ ├── 977A - Wrong Subtraction.cpp │ ├── 978B - File Name.cpp │ ├── B │ │ ├── CCPCGA.cpp │ │ ├── CCPCGB.cpp │ │ ├── CCPCGC.cpp │ │ └── CCPCGD.cpp │ ├── C1141A.cpp │ ├── C1141C.cpp │ ├── C1141C2.cpp │ ├── C1141D.cpp │ ├── C1141F.cpp │ ├── CodeForces-ProblemSet试题分类表.xlsx │ ├── template.cpp │ └── ~$CodeForces-ProblemSet试题分类表.xlsx └── judge.u-aizu.ac.jp │ ├── Algorithms and Data Structures I │ ├── ALDS1_1_A_InsertionSort.cpp │ ├── ALDS1_1_B_GCD.cpp │ ├── ALDS1_1_C_PrimerNumbers.cpp │ ├── ALDS1_1_D_MaximumProfit.cpp │ ├── ALDS1_1_D_MaximumProfit2.cpp │ ├── ALDS1_1_D_MaximumProfit3.cpp │ ├── ALDS1_2_A_BubbleSort.cpp │ ├── ALDS1_2_B_SelectionSort.cpp │ ├── ALDS1_2_C_StableSort.cpp │ ├── ALDS1_2_D_ShellSort.cpp │ ├── ALDS1_3_A_Stack.cpp │ ├── ALDS1_3_B_Queue.cpp │ ├── ALDS1_3_C_DoubleLinkedList.cpp │ ├── ALDS1_4_A_LinearSearch.cpp │ ├── ALDS1_4_B_BinarySearch.cpp │ ├── ALDS1_4_C_Dictionary.cpp │ ├── ALDS1_4_D_Allocation.cpp │ ├── ALDS1_5_A_DFS.cpp │ ├── ALDS1_5_A_ExhaustiveSearch.cpp │ ├── ALDS1_5_B_MergeSort.cpp │ ├── ALDS1_5_C_KochCurve.cpp │ ├── ALDS1_5_D_MergeSortInversion.cpp │ ├── ALDS1_6_A_CountingSort.cpp │ ├── ALDS1_6_B_MergeSort.cpp │ ├── Ex0202Top3A.cpp │ ├── Ex0202Top3B.cpp │ ├── Ex0202Top3C.cpp │ └── in.txt │ ├── Computer Geometry │ ├── CGL_1_A_Projection.cpp │ └── CGL_1_B_Reflection.cpp │ ├── Data Sets and Queries │ └── DSL_1_A_DisjointSet.cpp │ ├── Introduction to Programming I │ ├── ITP1_10_A_Distance.cpp │ ├── ITP1_10_B_Triangle.cpp │ ├── ITP1_10_C_StandardDeviation.cpp │ ├── ITP1_10_D_DistanceII.cpp │ ├── ITP1_11_DiceI.cpp │ ├── ITP1_11_DiceII.cpp │ ├── ITP1_11_DiceIII.cpp │ ├── ITP1_11_DiceIV.cpp │ ├── ITP1_1_A_HelloWorld.cpp │ ├── ITP1_1_B_XCubic.cpp │ ├── ITP1_1_C_Rectangle.cpp │ ├── ITP1_1_D_Watch.cpp │ ├── ITP1_2_A_SmallLargEqual.cpp │ ├── ITP1_2_B_Range.cpp │ ├── ITP1_2_C_SortTHreeNumbers.cpp │ ├── ITP1_2_D_CircleInARectangle.cpp │ ├── ITP1_3_A_PrintManyHelloWorld.cpp │ ├── ITP1_3_B_PrintCase.cpp │ ├── ITP1_3_C_SwapTwoNumbers.cpp │ ├── ITP1_3_D_HowManyDivisors.cpp │ ├── ITP1_4_A_Computation.cpp │ ├── ITP1_4_B_Circle.cpp │ ├── ITP1_4_C_Calculator.cpp │ ├── ITP1_4_D_MinMaxSum.cpp │ ├── ITP1_5_A_PrintARectangle.cpp │ ├── ITP1_5_B_PrintAFrame.cpp │ ├── ITP1_5_C_PrintAChessBoard.cpp │ ├── ITP1_5_D_StructualProgramming.cpp │ ├── ITP1_6_A_ReverseNumbers.cpp │ ├── ITP1_6_B_FindMissingCards.cpp │ ├── ITP1_6_C_OfficialHouse.cpp │ ├── ITP1_6_D_MatrixVectorMultiplication.cpp │ ├── ITP1_7_A_Grading.cpp │ ├── ITP1_7_B_HowManyWays.cpp │ ├── ITP1_7_C_SpreadSheet.cpp │ ├── ITP1_7_D_MaxtrixMultiplication.cpp │ ├── ITP1_8_A_TogglingCases.cpp │ ├── ITP1_8_B_DigitsSum.cpp │ ├── ITP1_8_C_CountingCharacters.cpp │ ├── ITP1_8_D_Ring.cpp │ ├── ITP1_9_A_FindingAWord.cpp │ ├── ITP1_9_B_Shuffle.cpp │ ├── ITP1_9_C_CardGame.cpp │ ├── ITP1_9_D_Transformation.cpp │ └── in.txt │ ├── Introduction to Programming II │ ├── ITP2_10_A_BitOperationI.cpp │ ├── ITP2_10_B_BitOperationII.cpp │ ├── ITP2_10_C_BitOperationFlag.cpp │ ├── ITP2_10_D_BitOperationMask.cpp │ ├── ITP2_1_A_Vector.cpp │ ├── ITP2_1_B_Deque.cpp │ ├── ITP2_1_C_List.cpp │ ├── ITP2_1_D_VectorII.cpp │ ├── ITP2_2_A_Stack.cpp │ ├── ITP2_2_B_Queue.cpp │ ├── ITP2_2_C_PriorityQueue.cpp │ ├── ITP2_2_D_Splice.cpp │ ├── ITP2_3_A_MinMax.cpp │ ├── ITP2_3_B_MinMaxElement.cpp │ ├── ITP2_3_C_Count.cpp │ ├── ITP2_3_D_LogicalComparison.cpp │ ├── ITP2_4_A_Reverse.cpp │ ├── ITP2_4_B_Rotate.cpp │ ├── ITP2_4_C_Swap.cpp │ ├── ITP2_4_D_Unique.cpp │ ├── ITP2_5_A_SortingPairs.cpp │ ├── ITP2_5_B_SortingTuples.cpp │ ├── ITP2_5_C_NextPermulation.cpp │ ├── ITP2_5_D_EnumPermulation.cpp │ ├── ITP2_6_A_BinarySearch.cpp │ ├── ITP2_6_B_Includes.cpp │ ├── ITP2_6_C_LowerBound.cpp │ ├── ITP2_6_D_EqualRange.cpp │ ├── ITP2_7_A_Search.cpp │ ├── ITP2_7_B_Delete.cpp │ ├── ITP2_7_C_RangeSearch.cpp │ ├── ITP2_7_C_RangeSearch_TLE.cpp │ ├── ITP2_7_D_Multiset.cpp │ ├── ITP2_8_A_Search.cpp │ ├── ITP2_8_B_Delete.cpp │ ├── ITP2_8_C_RangeSearch.cpp │ ├── ITP2_8_D_MultiMap.cpp │ ├── ITP2_9_A_SetUnion.cpp │ ├── ITP2_9_B_SetIntersection.cpp │ ├── ITP2_9_C_SetDifference.cpp │ ├── ITP2_9_D_SetSysmetricDifference.cpp │ └── in.txt │ └── Number Theory │ ├── NTL_1_A_PrimeFactorize.cpp │ ├── NTL_1_B_Power.cpp │ ├── NTL_1_C_LCM.cpp │ ├── NTL_1_D_EulerFunction.cpp │ ├── NTL_1_E_exGCD.cpp │ └── NTL_2_A_AdditionOfBigIntegers.cpp ├── README.md ├── a ├── cmake-build-debug ├── CMakeCache.txt ├── Makefile ├── Project.cbp ├── cmake_install.cmake ├── cplusplu ├── cplusplus ├── cplusplus.cbp ├── cplusplus2 ├── input.txt ├── kernal.txt ├── kernal_out.txt └── out.txt ├── input.txt ├── main.cpp ├── makeData.cpp ├── makeOutputData.cpp ├── out └── build │ └── x64-Debug │ ├── .cmake │ └── api │ │ └── v1 │ │ ├── query │ │ └── client-MicrosoftVS │ │ │ └── query.json │ │ └── reply │ │ ├── cache-v2-b3c940edcbdb4c04aa6f.json │ │ ├── cmakeFiles-v1-6e7df9d214d038cc5e8c.json │ │ ├── codemodel-v2-f8eae3b557752dd69ecf.json │ │ ├── index-2019-08-10T08-48-44-0302.json │ │ └── target-cplusplus2-Debug-6a25d04cab9bd7b6bc6f.json │ ├── CMakeCache.txt │ ├── CMakeFiles │ ├── 3.14.19060802-MSVC_2 │ │ ├── CMakeCCompiler.cmake │ │ ├── CMakeCXXCompiler.cmake │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ ├── CMakeRCCompiler.cmake │ │ ├── CMakeSystem.cmake │ │ ├── CompilerIdC │ │ │ └── CMakeCCompilerId.c │ │ └── CompilerIdCXX │ │ │ └── CMakeCXXCompilerId.cpp │ ├── CMakeOutput.log │ ├── ShowIncludes │ │ ├── foo.h │ │ └── main.c │ ├── TargetDirectories.txt │ ├── cmake.check_cache │ ├── feature_tests.bin │ ├── feature_tests.c │ └── feature_tests.cxx │ ├── Testing │ └── Temporary │ │ └── LastTest.log │ ├── VSInheritEnvironments.txt │ ├── build.ninja │ ├── cmake_install.cmake │ └── rules.ninja ├── template.cpp ├── test.cpp ├── tramsform的使用.cpp └── 测试文档.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # ---> C++ 2 | # Compiled Object files 3 | *.slo 4 | *.lo 5 | *.o 6 | *.obj 7 | 8 | # Precompiled Headers 9 | *.gch 10 | *.pch 11 | 12 | # Compiled Dynamic libraries 13 | *.so 14 | *.dylib 15 | *.dll 16 | 17 | # Fortran module files 18 | *.mod 19 | 20 | # Compiled Static libraries 21 | *.lai 22 | *.la 23 | *.a 24 | *.lib 25 | 26 | # Executables 27 | *.exe 28 | *.out 29 | *.app 30 | -------------------------------------------------------------------------------- /.idea/cplusplus.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/ACMProgramming.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/contest01/C.java: -------------------------------------------------------------------------------- 1 | package contest01; 2 | import java.util.Scanner; 3 | 4 | /** 5 | * Created by WebTuring on 2017-6-29. 6 | * 字符串 7 | * 正则表达式 8 | */ 9 | public class C { 10 | public static void main(String[] args) { 11 | Scanner cin = new Scanner(System.in); 12 | for (String word : cin.nextLine().split("\\W+")) 13 | System.out.println(word); 14 | cin.close(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/contest02/A.java: -------------------------------------------------------------------------------- 1 | package contest02; 2 | 3 | import java.util.Arrays; 4 | import java.util.Scanner; 5 | import java.util.TreeSet; 6 | 7 | public class A { 8 | 9 | 10 | public static void main(String[] args) { 11 | 12 | Scanner cin = new Scanner(System.in); 13 | String[] words = cin.nextLine().split("\\s+"); 14 | TreeSet set = new TreeSet<>(); 15 | set.addAll(Arrays.asList(words)); 16 | System.out.println(set.size()); 17 | cin.close(); 18 | } 19 | 20 | 21 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/contest02/B.java: -------------------------------------------------------------------------------- 1 | package contest02; 2 | 3 | import java.math.BigInteger; 4 | import java.util.Scanner; 5 | 6 | public class B { 7 | 8 | public static void main(String[] args) { 9 | 10 | Scanner cin = new Scanner(System.in); 11 | while(cin.hasNext()){ 12 | int n = cin.nextInt(); 13 | BigInteger ans = BigInteger.ONE; 14 | for(int i=1;i<=n;i++){ 15 | ans = ans.multiply(BigInteger.valueOf(i)); 16 | } 17 | System.out.println(ans); 18 | } 19 | 20 | cin.close(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/contest03/BP1739.java: -------------------------------------------------------------------------------- 1 | package contest03; 2 | 3 | /** 4 | * Created by WebTuring on 2017-7-3. 5 | */ 6 | public class BP1739 { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/contest04/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main(int argc, char const *argv[]) { 7 | int a[6] = {100, 50, 10, 5, 2, 1}; 8 | for (int n, t; cin >> n && n;) { 9 | int tot = 0; 10 | for (int t; n-- && cin >> t;) 11 | for (int i = 0; i < 6; i++) tot += t / a[i], t %= a[i]; 12 | cout << tot << endl; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/1119.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int main() 5 | { 6 | char *buf=new char[1000]; 7 | while(gets(buf)) 8 | { 9 | char *p=strtok(buf," "); 10 | int a,b; 11 | sscanf(p,"%d",&a); 12 | p=strtok(NULL," "); 13 | sscanf(p,"%d",&b); 14 | if(a==0 &&b==0) 15 | break; 16 | printf("%d\n",a+b); 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/1282.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | class s 5 | { 6 | private: 7 | double d; 8 | public: 9 | void print() 10 | { 11 | while(cin>>d) 12 | printf("%.2f\n",d>0?d:-d); 13 | } 14 | }; 15 | int main() 16 | { 17 | s t; 18 | t.print(); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/A.java: -------------------------------------------------------------------------------- 1 | package lec01; 2 | public class A { 3 | public static void main(String[] args) { 4 | System.out.println("Hello world"); 5 | } 6 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/AAddB.java: -------------------------------------------------------------------------------- 1 | package lec01; 2 | 3 | public class AAddB { 4 | public static void main(String[] args) { 5 | java.util.Scanner s = new java.util.Scanner(System.in); 6 | int a = s.nextInt(); 7 | int b = s.nextInt(); 8 | System.out.println(a + b); 9 | s.close(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/AAddB2.java: -------------------------------------------------------------------------------- 1 | package lec01; 2 | import java.util.Scanner; 3 | 4 | public class AAddB2 { 5 | public static void main(String[] args) { 6 | Scanner s = new Scanner(System.in); 7 | int a = s.nextInt(); 8 | int b = s.nextInt(); 9 | System.out.println(a + b); 10 | s.close(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/DateTypeDemo.java: -------------------------------------------------------------------------------- 1 | package lec01; 2 | public class DateTypeDemo { 3 | public static void main(String[] args) { 4 | int x = 3; 5 | System.out.println(Integer.toBinaryString(x)); 6 | int y = Integer.parseInt("1234"); 7 | char c = 'x'; 8 | System.out.println(Character.isLetter(c)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/add.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | class add 6 | { 7 | public: 8 | int a; 9 | int operator + (add b) 10 | { 11 | return this->a*b.a; 12 | } 13 | }; 14 | int main() 15 | { 16 | add a,b; 17 | a.a=2; 18 | b.a=3; 19 | cout< 2 | using namespace std; 3 | class s 4 | { 5 | private: 6 | int a; 7 | public: 8 | int b; 9 | void changea(int n); 10 | void printa() 11 | { 12 | cout<a<a=n; 18 | } 19 | int main() 20 | { 21 | s t; 22 | t.changea(10); 23 | t.printa(); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/demo2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | struct node 4 | { 5 | int x; 6 | inline int operator +(node &a) const 7 | { 8 | return x+a.x; 9 | } 10 | }; 11 | int main() 12 | { 13 | node a,b; 14 | a.x=b.x=5; 15 | cout< 16 | using namespace std; 17 | int main() { 18 | int a, b; 19 | while (cin >> a >> b) cout << a + b << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/hdu1090_io.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Sample Input 4 | 2 5 | 1 5 6 | 10 20 7 | 8 | Sample Output 9 | 10 | 6 11 | 30 12 | 13 | http://acm.hdu.edu.cn/showproblem.php?pid=1090 14 | */ 15 | #include 16 | using namespace std; 17 | int main() { 18 | int cas, a, b; 19 | cin >> cas; 20 | while (cas--) { 21 | cin >> a >> b; 22 | cout << a + b << endl; 23 | } 24 | return 0; 25 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/hdu1091_io.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Sample Input 4 | 1 5 5 | 10 20 6 | 0 0 7 | Sample Output 8 | 6 9 | 30 10 | 11 | http://acm.hdu.edu.cn/showproblem.php?pid=1091 12 | */ 13 | #include 14 | using namespace std; 15 | int main() { 16 | int a, b; 17 | while (cin >> a >> b) { 18 | if (a == 0 && b == 0) break; 19 | cout << a + b << endl; 20 | } 21 | return 0; 22 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/hdu1092_io.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Sample Input 4 | 5 | 4 1 2 3 4 6 | 5 1 2 3 4 5 7 | 0 8 | 9 | Sample Output 10 | 11 | 10 12 | 15 13 | 14 | 15 | http://acm.hdu.edu.cn/showproblem.php?pid=1092 16 | */ 17 | #include 18 | using namespace std; 19 | int main() { 20 | int n, k; 21 | while (cin >> n) { 22 | if (n == 0) break; 23 | int s = 0; 24 | while (n--) { 25 | cin >> t; 26 | s += t; 27 | } 28 | cout << s << endl; 29 | } 30 | return 0; 31 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/hdu1093_io.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Sample Input 4 | 2 5 | 4 1 2 3 4 6 | 5 1 2 3 4 5 7 | 8 | 9 | Sample Output 10 | 11 | 10 12 | 15 13 | 14 | 15 | http://acm.hdu.edu.cn/showproblem.php?pid=1093 16 | */ 17 | #include 18 | using namespace std; 19 | int main() { 20 | int cas, n, k; 21 | cin >> cas; 22 | while (cas--) { 23 | cin >> n; 24 | int s = 0; 25 | while (n--) { 26 | cin >> k; 27 | s += k; 28 | } 29 | cout << s << endl; 30 | } 31 | return 0; 32 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/hdu1094_io.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Sample Input 4 | 5 | 4 1 2 3 4 6 | 5 1 2 3 4 5 7 | 8 | 9 | Sample Output 10 | 11 | 10 12 | 15 13 | 14 | 15 | http://acm.hdu.edu.cn/showproblem.php?pid=1094 16 | */ 17 | #include 18 | using namespace std; 19 | int main() { 20 | int n, k; 21 | while (cin >> n) { 22 | int s = 0; 23 | while (n--) { 24 | cin >> k; 25 | s += k; 26 | } 27 | cout << s << endl; 28 | } 29 | return 0; 30 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/hdu1095_io.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | /** 4 | Sample Input 5 | 1 5 6 | 10 20 7 | Sample Output(one blank line follow case) 8 | 6 9 | 10 | 30 11 | 12 | http://acm.hdu.edu.cn/showproblem.php?pid=1095 13 | */ 14 | int main() { 15 | int a, b; 16 | while (cin >> a >> b) cout << a + b << endl << endl; 17 | int sys; 18 | sys = sys + 1; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/io.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | char n[100]; 8 | cin>>n; 9 | char *p=strtok(n," "); 10 | while(p!=NULL) 11 | { 12 | cout< 17 | #include 18 | using namespace std; 19 | int main() { 20 | int N, i; 21 | double sum; 22 | while (cin >> N) { 23 | sum = 0; 24 | for (i = 2; i <= N; i++) sum += log10(i); 25 | cout << (int)sum + 1 << endl; 26 | } 27 | return 0; 28 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/qsort_sort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int cmp(const void* a, const void* b) { return *(int*)a - *(int*)b; } 6 | int main() { 7 | int data[10]; 8 | for (int i = 0; i < 5; i++) cin >> data[i]; 9 | qsort(data, 5, sizeof(data[0]), cmp); 10 | for (int i = 0; i < 5; i++) cout << a[i] << endl; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/stl_sort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() { 6 | int data[10]; 7 | for (int i = 0; i < 5; i++) cin >> data[i]; 8 | sort(data, data + 5); 9 | for (int i = 0; i < 5; i++) cout << a[i] << endl; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec01/typeid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | void judge(int n) 6 | { 7 | cout<<"int"< 2 | #include 3 | #include 4 | using namespace std; 5 | namespace s 6 | { 7 | int y; 8 | void judge() 9 | { 10 | if(y%4==0&&y%100!=0||y%400==0) 11 | cout<<"yes"<>y) 21 | { 22 | judge(); 23 | } 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec02/Practice1.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zj on 17-6-29. 3 | */ 4 | public class Practice1 { 5 | public static void main(String[] args) { 6 | int x=1023; 7 | String s=Integer.toString(x); 8 | String s2=s.substring(1);//"023" 9 | int y=Integer.parseInt(s2);//23 10 | System.out.println(y); 11 | System.out.println(Integer.parseInt(Integer.toString(x).substring(1))); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec02/cyclist.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | cout << "Hello" << endl; 5 | return 0; 6 | } -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec02/readme.MD: -------------------------------------------------------------------------------- 1 | # 知识点 2 | ## 例题 3 | ## 习题 4 | ## AOJ对应练习题(增补及数据完善) -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec02pm/BigAddAB.java: -------------------------------------------------------------------------------- 1 | package lec02pm; 2 | 3 | import java.math.BigInteger; 4 | import java.util.Scanner; 5 | 6 | /** 7 | * Created by zj on 17-6-29. 8 | */ 9 | public class BigAddAB { 10 | public static void main(String[] args) { 11 | Scanner cin=new Scanner(System.in); 12 | BigInteger a=new BigInteger(cin.next()); 13 | BigInteger b=cin.nextBigInteger(); 14 | System.out.println(a.multiply(b)); 15 | cin.close(); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec02pm/P1039.java: -------------------------------------------------------------------------------- 1 | package lec02pm; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * Created by zj on 17-6-29. 7 | */ 8 | public class P1039 { 9 | public static void main(String[] args) { 10 | BigInteger prod=new BigInteger("1"); 11 | for (int i = 2; i <=1997 ; i++) { 12 | prod=prod.multiply(new BigInteger(Integer.toString(i))); 13 | } 14 | System.out.println(prod); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec03am/NullPointerDemo.java: -------------------------------------------------------------------------------- 1 | package lec03am; 2 | 3 | /** 4 | * Created by zj on 17-6-30. 5 | */ 6 | public class NullPointerDemo { 7 | public static void main(String[] args) { 8 | String a[] = new String[10]; 9 | for (int i = 0; i < a.length; i++) { 10 | System.out.print(a[i]); 11 | } 12 | System.out.println(a[0].length()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec03am/SortDemo2.java: -------------------------------------------------------------------------------- 1 | package lec03am; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | 6 | /** 7 | * Created by zj on 17-6-30. 8 | */ 9 | public class SortDemo2 { 10 | public static void main(String[] args) { 11 | Integer a[] = {1, 3, 5, 7, 9, 2, 4, 6, 8, 0}; 12 | Arrays.sort(a); 13 | System.out.println(Arrays.toString(a)); 14 | Arrays.sort(a, Collections.reverseOrder()); 15 | System.out.println(Arrays.toString(a)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec03am/aoj1042_factorial.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | Description 3 | 计算一个整数N的阶乘 4 | Input 5 | 一个整数N, (0〈=N〈=12) 6 | Output 7 | 整数N的阶乘. 8 | Sample Input 9 | 5 10 | Sample Output 11 | 120 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | using namespace std; 18 | int fact(int n) { return n == 0 ? 1 : fact(n - 1) * n; } 19 | int main() { 20 | int n; 21 | while (cin >> n) cout << fact(n) << endl; 22 | return 0; 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec03am/readme.MD: -------------------------------------------------------------------------------- 1 | # 知识点 2 | ## 例题 3 | ## 习题 4 | ## AOJ对应练习题(增补及数据完善) -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec05/readme.MD: -------------------------------------------------------------------------------- 1 | # 知识点 2 | ## 例题 3 | ## 习题 4 | ## AOJ对应练习题(增补及数据完善) -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec06/outline.MD: -------------------------------------------------------------------------------- 1 | ## 搜索入门 2 | 3 | ### 深度优先搜索(DFS) Depth-First-Serach 4 | - DFS的本质来讲是递归,递归就是自己调用自己 5 | ``` 6 | void dfs(){ 7 | dfs(); 8 | } 9 | ``` 10 | - 一个函数dfs()的内部又调用了自己,这就叫递归. 11 | 我们很容易发现上面那个dfs()是个无限循环,很简单,因为没有终至条件,自然会一直dfs()下去,所以递归一般来讲还要有终止条件. 12 | 13 | ``` 14 | void dfs(int step) { 15 | if (step == 5) return; 16 | dfs(step + 1); 17 | } 18 | ``` 19 | 20 | - 我们稍微修改一下,这样就能停止了. 21 | 22 | 显然DFS是一种一条路走到黑的方法,例如有N个阶段,我在第N个阶段走不通就返回第N-1个阶段尝试其他的可能,N-1不行我再返回到第N-2个阶段….. 23 | 24 | 25 | -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec06/readme.MD: -------------------------------------------------------------------------------- 1 | # 知识点 2 | ## 例题 3 | ## 习题 4 | ## AOJ对应练习题(增补及数据完善) -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec09/readme.MD: -------------------------------------------------------------------------------- 1 | # 知识点 2 | ## 例题 3 | ## 习题 4 | ## AOJ对应练习题(增补及数据完善) -------------------------------------------------------------------------------- /ACM/2017ACM集训/lec15/phi.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/2017ACM集训/lec15/phi.cpp -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_CXX_STANDARD 11) 2 | add_executable(cp4 lec01/D1.cpp) -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/README.md: -------------------------------------------------------------------------------- 1 | # 2019ACMStep 2 | 2019ACM中级算法 网络课 3 | -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec/outline.md: -------------------------------------------------------------------------------- 1 | #
树状数组
2 | ## 单点修改,区间查询 3 | # *线段树* -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec01/A1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main() { 7 | ifstream cin("A.in");//代码洁癖 8 | LL a, b, c; 9 | char op, eq; 10 | int tot = 0; 11 | while (cin >> a >> op >> b >> eq >> c) {//ok 12 | if (op == '+') { 13 | if (a + b == c)++tot; 14 | } else if (op == '-') { 15 | if (a - b == c)++tot; 16 | } 17 | } 18 | cout << "RIGHT:" << tot << endl; 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec01/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | // bitset<32> b(65535<<8>>16); 7 | // cout<> n; 10 | if (n < 256)n += 256;//(1) 11 | // n=(n<<16)>>16;//舍去高16位 rand() [0,RAND_MAX) 12 | n = (n & ((1 << 16) - 1)); 13 | n = n * n; 14 | n = (n << 8) >> 16; 15 | cout << n << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec01/C.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n = 6;//cin>>n; 7 | int m = n * 2; 8 | int k = sqrt(m); 9 | if (k * (k + 1) == m)cout << "YES" << endl; 10 | else cout << "NO" << endl; 11 | 12 | return 0; 13 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec02/A_square.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() {//O(n^2) 6 | int n = 100005; 7 | cin >> n; 8 | for (int i = 1; i <= n / 2; i++) 9 | for (int j = i + 1; j <= n - i; j++) { 10 | int s = (i + j) * (j - i + 1) / 2; 11 | if (s == n) { 12 | cout << i << " " << j << endl; 13 | } 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/app2.cpp: -------------------------------------------------------------------------------- 1 | //排序去重的set版本 2 | #include 3 | 4 | using namespace std; 5 | 6 | 7 | int main() { 8 | int a[] = {1, 1, 6, 3, 3,}; 9 | set S;//排序树(红黑树)实现的集合 10 | for (int i = 0; i < 5; i++)S.insert(a[i]);//如果a[i]不在这个集合中O(logN),就把a[i]元素放入这个树种依然保持树的有序性O(logN) 11 | cout << S.size() << endl; 12 | for (auto e:S)//for each 13 | cout << e << " "; 14 | cout << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/array_bad.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | const int MAXN = 1000; 5 | int a[MAXN]; 6 | 7 | int main() { 8 | 9 | int *p = (int *) malloc(sizeof(int) * 100000); 10 | if (p != NULL) { 11 | //开辟成功 12 | } else { 13 | //申请失败 14 | } 15 | free(p); 16 | int *q = new int[1000]; 17 | // 18 | free(q);//释放内存 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/map.cpp: -------------------------------------------------------------------------------- 1 | //map基本应用 map 里面每一个节点都是pair,整体数据结构是一个排序树 2 | #include 3 | 4 | using namespace std; 5 | 6 | 7 | int main() { 8 | ifstream cin("input.txt"); 9 | map M; 10 | for (string s; cin >> s;) { 11 | M[s]++; 12 | } 13 | for (auto e:M) { 14 | cout << e.first << ":" << e.second << endl; 15 | } 16 | return 0; 17 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/queue.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | //int data[1000],head,tail; 5 | 6 | int main() { 7 | queue Q;//FIFO 8 | for (int i = 0; i < 10; i++)Q.push(i);//0~9依次入队 9 | while (not Q.empty()) { 10 | cout << Q.front() << endl;//队头元素 11 | Q.pop();// 12 | } 13 | return 0; 14 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/stack.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int Stack[1000], top = -1; 5 | 6 | //括号配对 进制转化 递归化简 后缀式计算 7 | int main() { 8 | stack S;//FILO 9 | for (int i = 0; i < 10; i++)S.push(i); 10 | while (not S.empty()) { 11 | cout << S.top() << endl; 12 | S.pop(); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/str2int.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n = 123456, m; //m=612345; 7 | char buffer[100]; 8 | //printf("%d%d", n % 10, n / 10); 9 | sprintf(buffer, "%d%d", n % 10, n / 10);//int2str 10 | //scanf("%d", &m); 11 | sscanf(buffer, "%d", &m);//str2int atoi/itoa 不是ASCI C的标准API 12 | printf("%d\n", m); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/str2int2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n = 1234, m; 7 | ostringstream oss; 8 | oss << n % 10 << n / 10;//cout 9 | // cout << oss.str() << endl;//string 10 | istringstream iss(oss.str()); 11 | iss >> m;//cin 12 | cout << m << endl; 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/lec03/strstr2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string s("to know everything is to know nothing"); 7 | string t = "to"; 8 | auto pos = s.find(t); 9 | if (pos == string::npos) {//npos string中内置的一个静态常数,表示不可能的位置 10 | cout << "not found!" << endl; 11 | } else { 12 | cout << pos << endl; 13 | } 14 | pos = s.find(t, pos + t.size()); 15 | cout << pos << endl; 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /ACM/2019ACM中级算法网络课(bilibli直播)/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | 6 | cout<<"Welcome everybody!"< 2 | 3 | using namespace std; 4 | 5 | void print(int *a, int *b) { 6 | copy(a, b, ostream_iterator(cout, " ")); 7 | cout << endl; 8 | } 9 | 10 | int main() { 11 | int a[] = {1, 3, 5, 7, 9, 2, 4, 6, 8, 0}; 12 | int n = sizeof(a) / sizeof(a[0]); 13 | for (int i = 0; i < n - 1; i++) { 14 | int j = min_element(a + i, a + n) - a; 15 | swap(a[i], a[j]); 16 | print(a, a + n); 17 | } 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec03math/NTL_1_A_PrimeFactorize.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | cout << n << ":"; 7 | for (int i = 2; n > 1; i++) { 8 | if (i * i > n) break; 9 | while (n % i == 0) { 10 | cout << " " << i; 11 | n /= i; 12 | } 13 | } 14 | if (n > 1) cout << " " << n; 15 | cout << endl; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec03math/NTL_1_B_Power.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long LL; 4 | const int MOD = 1e9 + 7; 5 | LL mpower(LL a, int n) { 6 | long long ans = 1; 7 | while (n > 0) { 8 | if (n & 1) { 9 | ans *= a; 10 | ans %= MOD; 11 | } 12 | a *= a % MOD; 13 | a %= MOD; 14 | n >>= 1; 15 | } 16 | return ans % MOD; 17 | } 18 | int main() { 19 | int n, m; 20 | cin >> m >> n; 21 | cout << mpower(m, n) << endl; 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec03math/NTL_1_C_LCM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long LL; 4 | LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; } 5 | LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } 6 | int main() { 7 | int n; 8 | cin >> n; 9 | int ans = 1; 10 | while (n--) { 11 | int t; 12 | cin >> t; 13 | ans = lcm(ans, t); 14 | } 15 | cout << ans << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec03math/NTL_1_D_EulerFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long LL; 4 | int phi(int n) { 5 | int ret = n; 6 | for (int i = 2; i * i <= n; i++) 7 | if (n % i == 0) { 8 | ret = ret / i * (i - 1); //先进行除法防止溢出(ret=ret*(1-1/p(i))) 9 | while (n % i == 0) n /= i; 10 | } 11 | if (n > 1) ret = ret / n * (n - 1); 12 | return ret; 13 | } 14 | int main() { 15 | int n; 16 | cin >> n; 17 | cout << phi(n) << endl; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/1212a.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main() //n! 5 | { 6 | int a[]= {0,1,2,3,4,5,6,7}; 7 | do 8 | { 9 | bool ok=true; 10 | for(int i=0; i<8; i++) 11 | for(int j=i+1; j<8; j++) 12 | if(abs(a[i]-a[j])==j-i) 13 | ok=false; 14 | if(ok) 15 | cout< 2 | #define N 4 3 | int a[N]; 4 | int used[N] = {0}; 5 | void fill() { 6 | int i; 7 | for (i = 0; i < 4; i++) a[i] = i + 1; 8 | } 9 | void dfs(int k) { 10 | if (k == N) { 11 | int i; 12 | for (i = 0; i < k; i++) 13 | if (used[i]) printf("%d ", a[i]); 14 | printf("\n"); 15 | return; 16 | } 17 | used[k] = 1; 18 | dfs(k + 1); 19 | used[k] = 0; 20 | dfs(k + 1); 21 | } 22 | int main() { 23 | fill(); 24 | dfs(0); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/dfs2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define N 4 3 | int a[N]; 4 | int used[N] = {0}; 5 | 6 | void dfs(int k) { 7 | if (k == N) { 8 | int i; 9 | for (i = 0; i < k; i++) 10 | if (used[i]) printf("%d ", a[i]); 11 | printf("\n"); 12 | return; 13 | } 14 | int i; 15 | for (i = 0; i < N; i++) 16 | if (used[i] == 0) { 17 | used[i] = 1; 18 | a[i] = k; 19 | dfs(k + 1); 20 | used[i] = 0; 21 | } 22 | } 23 | int main() { 24 | dfs(0); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/n的全排列.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/2019ACM集训/lec04dfsbfs/n的全排列.cpp -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/per1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main(){//n! 5 | int a, b, c, d; 6 | for (int a = 1; a <= 4; a++) 7 | for (int b = 1; b <= 4; b++) 8 | for (int c = 1; c <= 4; c++) 9 | for (int d = 1; d <= 4; d++) { 10 | if (a != b && a != c && a != d && b != c && b != d && c != d) 11 | printf("%d %d %d %d\n", a, b, c, d); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/per2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main() //n! 5 | { 6 | int a[]= {0,1,2,3,4,5,6,7}; 7 | do 8 | { 9 | bool ok=true; 10 | for(int i=0; i<8; i++) 11 | for(int j=i+1; j<8; j++) 12 | if(abs(a[i]-a[j])==j-i) 13 | ok=false; 14 | if(ok) 15 | cout< 3 | int main() { 4 | int a, b, c, d; 5 | for (int a = 1; a <= 4; a++) 6 | for (int b = 1; b <= 4; b++) 7 | for (int c = 1; c <= 4; c++) 8 | for (int d = 1; d <= 4; d++) { 9 | if (a != b && a != c && a != d && b != c && b != d && c != d) 10 | printf("%d %d %d %d\n", a, b, c, d) 11 | } 12 | 13 | return 0; 14 | } -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/perm0.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main(){ 5 | int a, b, c, d; 6 | for (int a = 1; a <= 4; a++) 7 | for (int b = 1; b <= 4; b++) 8 | for (int c = 1; c <= 4; c++) 9 | for (int d = 1; d <= 4; d++) { 10 | if (a != b && a != c && a != d && b != c && b != d && c != d) 11 | printf("%d %d %d %d\n", a, b, c, d); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/prob.md: -------------------------------------------------------------------------------- 1 | ## 1. 选人。一个小组共五人,分别为A、B、C、D、E。现有一项任务,要他们中的3个人去完成。已知:(1)A、C不能都去;(2)B、C不能都不去;(3)如果C去了,D、E就只能去一个,且必须去一个;(4)B、C、D不能都去;(5)如果B去了,D、E就不能都去。编程找出此项任务该由哪三人去完成的所有组合。 2 | ## 2 1~9分成1:2:3的三个3位数 3 | 将1到9 这九个数字分成三个3位数,分求第一个3位数,正好是第二个3位数的二倍,是第三个3位数的三倍。问应当怎样分法。 4 | ## 3 1~9组成三个3位的平方数 5 | ## 将1、2、3、4、5、6、7、8、9九个数字分成三组,每个数字只能用一次,即每组三个数不允许有重复数字,也不许同其它组的三个数字重复,要求每组中的三位数都组成一个平方数。 6 | ## 4 九位累进可除数 7 | ## 求九位累进可除数。所谓九位累进可除数就是这样一个数:这个数用到1到9这九个数字组成,每个数字刚好只出现一次。这九个位数的前两位能被2整除,前三位能被3整除......前N位能被N整除,整个九位数能被9整除。 8 | -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/search.md: -------------------------------------------------------------------------------- 1 | # lec11: 搜索 2 | 3 | ## 万能的解法之搜索 4 | 5 | - 解空间 6 | - 几何空间 7 | - 子集空间 8 | - 全排列空间 9 | - 深度优先搜索DFS 10 | - 广度优先搜索BFS 11 | 12 | ## 深度优先搜素dfs 13 | 14 | ## 利用dfs遍历子集空间 15 | 16 | ## 利用dfs遍历全排列空间 17 | 18 | # dfs应用 19 | ## 单调空间的二分搜索 20 | - 二分查找 21 | - 二分答案 22 | -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec04dfsbfs/subset2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int main() //2^4 0000~1111 5 | { 6 | int A[]={3,4,7,9},M=20; 7 | for(int i=0;i<(1< B(i); 10 | cout< 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int t; 7 | cin >> t; 8 | while (t--) { 9 | int n; 10 | cin >> n; 11 | cout << '['; 12 | for (int i = 1; i <= n; i++) 13 | cout << '>'; 14 | for (int i = 1; i <= 100 - n; i++) 15 | cout << ' '; 16 | cout << ']'; 17 | cout << setw(2) << setfill('0') << n << endl; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /ACM/2019ACM集训/lec08final/I.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | const int INF = 0x3f3f3f3f3f; 6 | 7 | const int MAXN = 1e5 + 10; 8 | int dis[MAXN]; 9 | int n, l, r; 10 | 11 | int main() { 12 | cin >> n; 13 | for (int i = 1; i <= n - 1; i++) { 14 | cin >> l >> r; 15 | dis[l]++; 16 | dis[r]++; 17 | } 18 | int res = 0; 19 | for (int i = 1; i <= n; i++) { 20 | res = max(dis[i] + 1, res); 21 | } 22 | cout << res << endl; 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /ACM/AHCPC/2010/A3.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | for (string a, b; getline(cin, a) and getline(cin, b);) { 8 | transform(a.begin(), a.end(), a.begin(), _tolower); 9 | transform(b.begin(), b.end(), b.begin(), _tolower); 10 | int ans = 0; 11 | for (auto p = b.find(a); p != string::npos; p = b.find(a, p + a.size())) ++ans; 12 | cout << ans << endl; 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /ACM/AHCPC/2011/I.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int n, m; cin >> n >> m;) { 7 | for (int i = 0; i <= n; i++) { 8 | int j = n - i; 9 | if (4 * i + 2 * j == m) { 10 | cout << i << " " << j << endl; 11 | break; 12 | } 13 | } 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /ACM/AHCPC/2012/D.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | int n; 8 | //freopen("D.in", "r", stdin); 9 | //freopen("D.out", "w", stdout); 10 | while (scanf("%d", &n) != EOF) { 11 | int sum = 0; 12 | for (int i = 0; i < n; i++) { 13 | int x; 14 | scanf("%d", &x); 15 | sum ^= x; 16 | } 17 | if (sum) printf("Yes\n"); 18 | else printf("No\n"); 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /ACM/AHCPC/2016/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n, ax, bx, ay, by; 7 | for (scanf("%d", &n); n--;) { 8 | scanf("%d%d%d%d", &ax, &ay, &bx, &by); 9 | printf("%d\n", abs(ax * ay - bx * by)); 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /ACM/AHCPC/2017/A.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/AHCPC/2017/A.cpp -------------------------------------------------------------------------------- /ACM/AHCPC/2017/B.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/AHCPC/2017/B.cpp -------------------------------------------------------------------------------- /ACM/AHCPC/2017/E.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/AHCPC/2017/E.cpp -------------------------------------------------------------------------------- /ACM/AHCPC/2018/C.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/AHCPC/2018/C.cpp -------------------------------------------------------------------------------- /ACM/AHCPC/2018/E.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/AHCPC/2018/E.cpp -------------------------------------------------------------------------------- /ACM/AHCPC/2018/K.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | typedef long long LL; 6 | 7 | int main() { 8 | LL n; 9 | int t; 10 | cin >> t; 11 | while (t--) { 12 | cin >> n; 13 | if (n % 4 == 0) { 14 | cout << "Bob win" << endl; 15 | } else { 16 | cout << "Alice win" << endl; 17 | } 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /ACM/AHCPC/2019/H.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | const int N = 3e2 + 5; 5 | char s[N]; 6 | int n, ans; 7 | 8 | int main() { 9 | scanf("%s", s + 1); 10 | n = strlen(s + 1); 11 | 12 | s[0] = '0'; 13 | for (int i = 2; i <= n; ++i) { 14 | if (s[i] == s[i - 1] || s[i] == s[i - 2]) 15 | ans++, s[i] = '0'; 16 | } 17 | 18 | printf("%d\n", ans); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /ACM/AHCPC/2019/_A2.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by webturing on 2019/5/19. 3 | // 4 | 5 | #include 6 | 7 | using namespace std; 8 | 9 | //2019ahcpc热身赛第一题: 喝个够 10 | //n瓶饮料 m个空瓶可以换一瓶饮料 问这个人最多可以喝多少瓶 11 | //数学算法 m个空瓶子可以换一瓶,所以实际上是m-1个瓶子换了一瓶(没有瓶子)的饮料 12 | //考虑到他最后必然手里有一个无法兑换的瓶子所以 n-1 13 | int main() { 14 | int n, m; 15 | cin >> n >> m; 16 | cout << n + (n - 1) / (m - 1) << endl; 17 | return 0; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /ACM/AHCPC/2020Sep/read.md: -------------------------------------------------------------------------------- 1 | 2020AHCPC 9月赛 2 | -------------------------------------------------------------------------------- /ACM/CCPC/2019CCPCwfinal/BGcd.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | using ll = long long; 5 | 6 | int main() { 7 | ll n; 8 | cin >> n; 9 | ll s = n * (n + 1) / 2; 10 | for (ll p = 2; p <= s; p++) { 11 | if (s % p == 0) { 12 | cout << s / p << endl; 13 | break; 14 | } 15 | } 16 | return 0; 17 | } -------------------------------------------------------------------------------- /ACM/CCPC/2019CCPCwfinal/JTangram.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | using LL = unsigned long long; 5 | 6 | int main() { 7 | LL n; 8 | cin >> n; 9 | LL r = 7 + 6 * n + n * (n - 1) / 2; 10 | cout << r << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /ACM/CCPC/CCPC2016hefei/A.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/CCPC/CCPC2016hefei/A.cpp -------------------------------------------------------------------------------- /ACM/CCPC/CCPC2016hefei/J.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/CCPC/CCPC2016hefei/J.cpp -------------------------------------------------------------------------------- /ACM/CCPC/CCPC2018/1010.txt: -------------------------------------------------------------------------------- 1 | 2 | 2 3 | 3 4 | 1 1 1 5 | 1 2 2 6 | 3 3 1 7 | 3 8 | 1 1 1 9 | 1 2 2 10 | 3 3 1 -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018/B.txt: -------------------------------------------------------------------------------- 1 | 2 10 2 | 1 1 1 23 3 | 1 1 0 233 4 | 2 1 1 5 | 1 2 1 2333 6 | 1 2 1 23333 7 | 3 1 2 1 8 | 2 2 0 9 | 2 1 1 10 | 2 1 0 11 | 2 1 1 12 | -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018/B2.txt: -------------------------------------------------------------------------------- 1 | 2 4 2 | 1 1 1 1 3 | 1 1 2 1 4 | 3 1 1 1 5 | 2 1 1 6 | -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018/C.txt: -------------------------------------------------------------------------------- 1 | 5 1 2 | 11010 3 | 5 2 4 | 11010 5 | 5 1 6 | 00111 7 | 6 2 8 | 011010 -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018/CAC.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/Contests/baiduStar2018/CAC.java -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018B/A.in: -------------------------------------------------------------------------------- 1 | 2 2 | 3 1 1 3 | 1 2 4 | 8 6 0 5 | 1 2 6 | 3 1 7 | 5 6 8 | 4 1 9 | 6 4 10 | 7 0 -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018B/B.in: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 | 012 4 | 3456 5 | 789ab 6 | cdef 7 | ghi 8 | 10 9 | 1 3 1 10 | 1 3 2 11 | 1 3 3 12 | 9 3 1 13 | 7 3 1 14 | 3 3 1 15 | 3 3 2 16 | 5 3 1 17 | 5 3 2 18 | 2 2 2 -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018B/C.in: -------------------------------------------------------------------------------- 1 | 1 2 | 11 2 3 | 0 1 100 4 | 0 2 199700 5 | 0 3 200 6 | 1 4 120000 7 | 1 5 80000 8 | 3 6 100000 9 | 3 7 100000 10 | 7 8 90000 11 | 7 9 90000 12 | 7 10 20000 -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018B/D.in: -------------------------------------------------------------------------------- 1 | 3 2 | 5 3 | -4 2 2 2 2 4 | 3 5 | 1 2 4 6 | 2 7 | 0 100000000 8 | -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018B/E.in: -------------------------------------------------------------------------------- 1 | 2 2 | 5 3 | 1 0 1 0 1 4 | 9 5 | 1 0 1 0 1 -3 4 0 4 -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018B/F.in: -------------------------------------------------------------------------------- 1 | 2 2 | 4 4 1 3 | 2 2 4 | 10 7 3 5 | 6 3 6 | 2 6 7 | 9 5 -------------------------------------------------------------------------------- /ACM/Contests/baiduStar2018B/G.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/Contests/baiduStar2018B/G.in -------------------------------------------------------------------------------- /ACM/Contests/nowcoder201807monthly/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | int sum = 0; 9 | int x; 10 | for (int i = 0; i < n; i++) { 11 | cin >> x; 12 | while (x % 2 == 0) { 13 | x /= 2; 14 | sum++; 15 | } 16 | } 17 | cout << sum << endl; 18 | return 0; 19 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/books.aHaAlgorithm/Dijkstra算法_单源最短路.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/代码模板库/BOOKS/books.aHaAlgorithm/Dijkstra算法_单源最短路.cpp -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/books.aHaAlgorithm/c0101BucketSort.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | ''' 3 | 数组的桶排序 O(n)*O(MAX-MIN) 4 | 5 | ''' 6 | 7 | MIN,MAX=0,100#约定每一个数据都在[0,100)之间 8 | def bucketSort(lst): 9 | ans=[] #返回值 10 | freq=[0]*(MAX-MIN) #每一个数频度都置为0 11 | for ele in lst: 12 | freq[ele]+=1 #统计频率 13 | for idx in xrange(MIN,MAX): #还原 14 | for k in xrange(freq[idx]): 15 | ans.append(idx), 16 | return ans 17 | 18 | if __name__=='__main__': 19 | lst=[2,8,5,3,5] 20 | print bucketSort(lst) -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/books.aHaAlgorithm/c0102BubbleSort.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | ''' 3 | 数组的冒泡排序 O(n^2) 4 | 5 | ''' 6 | 7 | 8 | def bubbleSort(lst): 9 | for i in xrange(len(lst)): 10 | for j in xrange(len(lst)-i-1): 11 | if lst[j]>lst[j+1]: 12 | lst[j],lst[j+1]=lst[j+1],lst[j] 13 | return lst 14 | 15 | 16 | if __name__=='__main__': 17 | lst=[12,35,99,18,76] 18 | print bubbleSort(lst) -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/books.aHaAlgorithm/c0103QuickSort.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | ''' 3 | 数组的快速排序 O(NlogN) 4 | 5 | ''' 6 | 7 | def quickSort(lst): 8 | if len(lst)<=1: 9 | return lst 10 | mid=[x for x in lst if x==lst[0]] 11 | left=[x for x in lst if xlst[0]] 13 | return quickSort(left)+mid+quickSort(right) 14 | 15 | 16 | if __name__=='__main__': 17 | lst=[6,1,7,2,9,3,4,5,10,8] 18 | print quickSort(lst) -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/books.aHaAlgorithm/c0104SelectionSort.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | ''' 3 | 数组的选择排序 O(n^2) 4 | 5 | ''' 6 | 7 | def selectionSort(lst): 8 | for i in xrange(len(lst)): 9 | minIndex=lst[i:].index(min(lst[i:]))+i ##容易犯错,查找的是lst[i:]的坐标,相对于lst应该+i 10 | lst[i],lst[minIndex]=lst[minIndex],lst[i] 11 | return lst 12 | 13 | 14 | if __name__=='__main__': 15 | lst=[12,35,99,18,76] 16 | print selectionSort(lst) -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/books.aHaAlgorithm/comments.MD: -------------------------------------------------------------------------------- 1 | # 啊哈算法 2 | - 基础算法教材 3 | - 可以作为算法导论的前奏 4 | - 看完就可以认真饱读AOCP -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/books.aHaAlgorithm/n的全排列.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/代码模板库/BOOKS/books.aHaAlgorithm/n的全排列.cpp -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/chapter02AlgorithmComplexity/ALDS0101DMaximumProfit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n; 7 | cin >> n; 8 | vector R(n); 9 | for (auto &i:R)cin >> i; 10 | //O(n^2) 11 | int maxv = -1; 12 | for (int j = 1; j < n; j++) 13 | for (int i = 0; i < j; i++) 14 | maxv = max(maxv, R[j] - R[i]); 15 | cout << maxv << endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/chapter02AlgorithmComplexity/ALDS0101DMaximumProfit3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n; 7 | cin >> n; 8 | int t; 9 | cin >> t; 10 | //O(N)+O(1) 11 | int maxv = -200000000; 12 | int minv = t; 13 | for (int i = 1; i < n; i++) { 14 | cin >> t; 15 | maxv = max(maxv, t - minv); 16 | minv = min(minv, t); 17 | } 18 | 19 | cout << maxv << endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/chapter02AlgorithmComplexity/Ex0202Top3B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main(int argc, char const *argv[]) { 7 | vector S(10); 8 | for (auto &i:S) { 9 | cin >> i; 10 | } 11 | sort(S.begin(), S.end()); 12 | copy(S.rbegin(), S.rbegin() + 3, ostream_iterator(cout, " ")); 13 | cout << endl; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/chapter02AlgorithmComplexity/Ex0202Top3C.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main(int argc, char const *argv[]) { 7 | vector S(10); 8 | for (auto &i:S)cin >> i; 9 | vector C(101, 0); 10 | for (auto s:S) { 11 | C[s]++; 12 | } 13 | int cnt = 3; 14 | for (int p = 100; cnt && p >= 0; p--) { 15 | while (C[p] && cnt) { 16 | cout << p << " "; 17 | --cnt; 18 | } 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0101.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | cout << 1 + 2 << endl; 5 | cout << 3 - 4 << endl; 6 | cout << 5 + 6 << endl; 7 | cout << 8 / 4 << endl; 8 | cout << 8 / 5 << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0102.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | cout << fixed << setprecision(1) << 8.0 / 5.0 << endl; 5 | cout << fixed << setprecision(1) << 8 / 5 << endl; 6 | cout << fixed << setprecision(0) << 8.0 / 5.0 << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0103.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | cout << fixed << setprecision(8) << (1 + 2 * sqrt(3)) / (5 - 0.1) << endl; 5 | return 0; 6 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0104.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int a, b; 5 | cin >> a >> b; 6 | cout << a + b << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0105.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const double PI = acos(-1); 4 | int main(int argc, char const *argv[]) { 5 | double r, h, s1, s2, s; 6 | cin >> r >> h; 7 | s1 = PI * r * r; 8 | s2 = 2 * PI * r * h; 9 | s = s1 * 2 + s2; 10 | cout << "Area = " << fixed << setprecision(3) << s << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0106.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int n = 120; 5 | int a = n / 100; 6 | int b = (n % 100) / 10; 7 | int c = n % 10; 8 | cout << c << b << a << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0107.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int n = 120; 5 | int a = n / 100; 6 | int b = (n % 100) / 10; 7 | int c = n % 10; 8 | cout << 100 * c + 10 * b + a << endl; 9 | cout << setw(3) << setfill('0') << 100 * c + 10 * b + a << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0108.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int a, b; 5 | cin >> a >> b; 6 | int t = a; 7 | a = b; 8 | b = t; 9 | cout << a << " " << b << endl; 10 | return 0; 11 | } 12 | // swap 1 -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0109.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int a, b; 5 | cin >> a >> b; 6 | a = a + b; 7 | b = a - b; 8 | a = a - b; 9 | cout << a << " " << b << endl; 10 | return 0; 11 | } 12 | // swap 2 -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0110.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int a, b; 5 | cin >> a >> b; 6 | cout << b << " " << a << endl; 7 | swap(a, b); 8 | cout << a << " " << b << endl; 9 | return 0; 10 | } 11 | // swap 3 -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0111.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int a, b, n, m; 5 | cin >> n >> m; 6 | a = (4 * n - m) / 2; 7 | b = n - a; 8 | if (m % 2 == 0 && a >= 0 && b >= 0) { 9 | cout << a << " " << b << endl; 10 | } else { 11 | cout << "No answer" << endl; 12 | } 13 | return 0; 14 | } 15 | //鸡兔同笼 -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/example0112.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | ifstream cin("sort3.in"); 5 | 6 | int a, b, c; 7 | while (cin >> a >> b >> c) { 8 | if (a > b) swap(a, b); 9 | if (a > c) swap(a, c); 10 | if (b > c) swap(b, c); 11 | cout << a << " " << b << " " << c << endl; 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch01/sort3.in: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | 1 3 2 3 | 2 1 3 4 | 2 3 1 5 | 3 1 2 6 | 3 2 1 7 | 1 1 2 8 | 1 2 1 9 | 2 1 1 10 | 1 1 1 -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch02/example0201.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | int n; 5 | cin >> n; 6 | for (int i = 1; i <= n; i++) { 7 | cout << i << endl; 8 | } 9 | return 0; 10 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch02/example0202.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | for (int a = 1; a <= 9; a++) 5 | for (int b = 0; b <= 9; b++) { 6 | int n = a * 1100 + b * 11; 7 | int m = floor(sqrt(n) + 0.5); 8 | if (m * m == n) cout << n << endl; 9 | } 10 | return 0; 11 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch02/example0203.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | for (int i = 34; i * i <= 9999; i++) { 5 | int a = i * i / 100; 6 | int b = i * i % 100; 7 | if (a % 11 == 0 && b % 11 == 0) { 8 | cout << i *i << endl; 9 | } 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch02/example0204.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | // int n;//bugs 5 | long long n; 6 | cin >> n; 7 | int cnt = 0; 8 | while (n > 1) { 9 | if (n % 2 == 0) { 10 | n /= 2; 11 | } else { 12 | n = 3 * n + 1; 13 | } 14 | ++cnt; 15 | } 16 | cout << cnt << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch03/UVa10082.cpp: -------------------------------------------------------------------------------- 1 | // UVa10082 WERTYU 2 | // Rujia Liu 3 | #include 4 | char s[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; 5 | int main() { 6 | int i, c; 7 | while((c = getchar()) != EOF) { 8 | for (i=1; s[i] && s[i]!=c; i++); // 找错位之后的字符在常量表中的位置 9 | if (s[i]) putchar(s[i-1]); // 如果找到,则输出它的前一个字符 10 | else putchar(c); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch03/UVa272.cpp: -------------------------------------------------------------------------------- 1 | // UVa272 Tex Quotes 2 | // Rujia Liu 3 | #include 4 | int main() { 5 | int c, q = 1; 6 | while((c = getchar()) != EOF) { 7 | if(c == '"') { printf("%s", q ? "``" : "''"); q = !q; } 8 | else printf("%c", c); 9 | } 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch03/readme.md: -------------------------------------------------------------------------------- 1 | 《算法竞赛入门经典》第二版 范例代码 2 | 3 | 刘汝佳 4 | 5 | 第三章 6 | 7 | 例题 8 | 9 | 注:所有代码都可以用C99和C++编译,为了和后面统一,后缀名均为cpp 10 | 11 | 3-1. UVa272 Tex Quotes 12 | 13 | 3-2. UVa10082 WERTYU 14 | 15 | 3-3. UVa401 Palindromes 16 | 17 | 3-4. UVa340 Master-Mind Hints 18 | 19 | 3-5. UVa1583 Digit Generator 20 | 21 | 3-6. UVa1584 Circular Sequence 22 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch04/fp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | 演示一些浮点误差 5 | 在笔者的环境下,运行结果为: 6 | 0.9999990 7 | 0.2499998 8 | 0.2 9 | */ 10 | 11 | int main() { 12 | double f; 13 | for(f = 2; f > 1; f -= 1e-6); 14 | printf("%.7f\n", f); 15 | printf("%.7f\n", f / 4); 16 | printf("%.1f\n", f / 4); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch04/point.cpp: -------------------------------------------------------------------------------- 1 | struct Point { 2 | double x, y; 3 | }; 4 | 5 | double dist(Point a, Point b) { return 0; } 6 | 7 | int main() { return 0; } 8 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch04/uva12412_sample.in: -------------------------------------------------------------------------------- 1 | 1 2 | 0011223344 1 John 79 98 91 100 3 | 0022334455 1 Tom 59 72 60 81 4 | 0011223344 2 Alice 100 100 100 100 5 | 2423475629 2 John 60 80 30 99 6 | 0 7 | 3 8 | 0022334455 9 | John 10 | 0 11 | 5 12 | 1 13 | 2 14 | 0011223344 15 | 0 16 | 5 17 | 0 18 | 4 19 | 0 20 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch05/5-1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int a, b; 5 | while(scanf("%d%d", &a, &b) == 2) printf("%d\n", a+b); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch05/5-2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() { 6 | long long a, b; 7 | while(cin >> a >> b) { 8 | cout << min(a,b) << "\n"; 9 | } 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch05/5-3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Point { 5 | int x, y; 6 | Point(int x=0, int y=0):x(x),y(y) {} 7 | }; 8 | 9 | int main() { 10 | Point p1, p2; 11 | swap(p1, p2); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch05/pq.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | struct cmp { 6 | bool operator() (const int a, const int b) const { // a的优先级比b小时返回true 7 | return a % 10 > b % 10; 8 | } 9 | }; 10 | 11 | int main() { 12 | priority_queue, cmp> pq; 13 | pq.push(1); 14 | pq.push(3); 15 | pq.push(22); 16 | pq.push(44); 17 | while(!pq.empty()) { 18 | cout << pq.top() << "\n"; 19 | pq.pop(); 20 | } 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part01-language/ch05/test_sstream.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() { 7 | string line; 8 | while(getline(cin, line)) { 9 | int sum = 0, x; 10 | stringstream ss(line); 11 | while(ss >> x) sum += x; 12 | cout << sum << "\n"; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part02-basic/ch6/UVa679.cpp: -------------------------------------------------------------------------------- 1 | // UVa679 Dropping Balls 2 | // Rujia Liu 3 | #include 4 | int main() { 5 | int T, D, I; 6 | scanf("%d", &T); 7 | while(T--) { 8 | scanf("%d%d", &D, &I); 9 | int k = 1; 10 | for(int i = 0; i < D-1; i++) 11 | if(I%2) { k = k*2; I = (I+1)/2; } 12 | else { k = k*2+1; I /= 2; } 13 | printf("%d\n", k); 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part02-basic/ch7/8a.in: -------------------------------------------------------------------------------- 1 | 2 6 4 1 3 7 0 5 8 2 | 8 1 5 7 3 6 4 0 2 3 | 4 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part02-basic/ch7/8b.in: -------------------------------------------------------------------------------- 1 | 1 2 3 4 5 6 7 8 0 2 | 1 2 3 4 5 6 8 7 0 3 | 4 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part02-basic/ch7/p1603.ans: -------------------------------------------------------------------------------- 1 | 4 2 | 6 3 | 8 4 | 8 5 | 7 6 | 7 7 | 2 8 | 4 9 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part02-basic/ch7/p1603.in: -------------------------------------------------------------------------------- 1 | 8 2 | 3 3 | 8 1 3 4 7 18 21 22 24 4 | 3 5 | 0 6 | 4 7 | 2 6 30 8 | 4 9 | 4 1 5 36 40 10 | 4 11 | 4 16 20 21 25 12 | 4 13 | 8 1 2 5 6 10 11 14 15 14 | 4 15 | 9 6 8 17 19 20 28 29 26 35 16 | 3 17 | 2 12 13 18 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part02-basic/ch7/pp3.cpp: -------------------------------------------------------------------------------- 1 | // 可重集的全排列(next_permutation版) 2 | // Rujia Liu 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int main() { 8 | int n, p[10]; 9 | scanf("%d", &n); 10 | for(int i = 0; i < n; i++) scanf("%d", &p[i]); 11 | sort(p, p+n); // 排序,得到p的最小排列 12 | do { 13 | for(int i = 0; i < n; i++) printf("%d ", p[i]); // 输出排列p 14 | printf("\n"); 15 | } while(next_permutation(p, p+n)); // 求下一个排列 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part02-basic/ch7/subset3.cpp: -------------------------------------------------------------------------------- 1 | // {0~n-1}的所有子集:二进制法 2 | // Rujia Liu 3 | #include 4 | using namespace std; 5 | 6 | void print_subset(int n, int s) { // 打印{0, 1, 2, ..., n-1}的子集S 7 | for(int i = 0; i < n; i++) 8 | if(s&(1< 4 | int main() { 5 | int n, T; 6 | scanf("%d", &T); 7 | while(T--) { 8 | scanf("%d", &n); 9 | int V = 0, E = 0; 10 | for(int i = 0; i <= n-2; i++) 11 | V += i*(n-2-i), E += i*(n-2-i)+1; 12 | V = V*n/4+n; 13 | E = E*n/2+n; 14 | printf("%d\n", E-V+1); 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part03-contest/ch10/UVa10288.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | 11 12 | 12 13 | 13 14 | 14 15 | 15 16 | 16 17 | 17 18 | 18 19 | 19 20 | 20 21 | 21 22 | 22 23 | 23 24 | 24 25 | 25 26 | 26 27 | 27 28 | 28 29 | 29 30 | 30 31 | 31 32 | 32 33 | 33 34 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part03-contest/ch10/UVa1641.cpp: -------------------------------------------------------------------------------- 1 | // UVa1641/LA5910 ASCII Area 2 | // Rujia Liu 3 | #include 4 | int main() { 5 | int h, w; 6 | char s[999]; 7 | while(scanf("%d%d", &h, &w) == 2) { 8 | int ans = 0, c = 0; 9 | while(h--) { 10 | scanf("%s", s); 11 | int in = 0; 12 | for(int i = 0; i < w; i++) { 13 | if(s[i] == '/' || s[i] == '\\') { c++; in = !in; } 14 | else if(in) ans++; 15 | } 16 | } 17 | printf("%d\n", ans + c/2); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part03-contest/ch10/UVa580.cpp: -------------------------------------------------------------------------------- 1 | // UVa580 Critical Mass 2 | // Rujia Liu 3 | #include 4 | using namespace std; 5 | 6 | int f[31], g[31]; 7 | 8 | int main() { 9 | f[0] = f[1] = f[2] = 0; 10 | g[0] = 1; g[1] = 2; g[2] = 4; 11 | for(int n = 3; n <= 30; n++) { 12 | f[n] = 1 << (n-3); 13 | for(int i = 2; i <= n-2; i++) 14 | f[n] += g[i-2] * (1 << (n-i-2)); 15 | g[n] = (1<> n && n) 19 | cout << f[n] << "\n"; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part03-contest/ch10/uva10491.cpp: -------------------------------------------------------------------------------- 1 | // UVa10491 Cows and Cars 2 | // Rujia Liu 3 | #include 4 | int main() { 5 | int a, b, c; 6 | while(scanf("%d%d%d", &a, &b, &c) == 3) 7 | printf("%.5lf\n", (double)(a*b+b*(b-1)) / (a+b) / (a+b-c-1)); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part03-contest/ch10/uva11346.cpp: -------------------------------------------------------------------------------- 1 | // UVa11346 Probability 2 | // Rujia Liu 3 | #include 4 | #include 5 | int main() { 6 | int T; 7 | scanf("%d", &T); 8 | while(T--) { 9 | double a, b, s, ans; 10 | scanf("%lf%lf%lf", &a, &b, &s); 11 | double m = a*b; 12 | if(fabs(s) < 1e-6) ans = 1; 13 | else if(s > m) ans = 0; 14 | else ans = (m - s - s * log(m/s)) / m; 15 | printf("%.6lf%%\n", ans * 100); 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part03-contest/ch10/uva12230.cpp: -------------------------------------------------------------------------------- 1 | // UVa12230 Crossing Rivers 2 | // Rujia Liu 3 | #include 4 | int main() { 5 | int n, D, p, L, v, kase = 0; 6 | while(scanf("%d%d", &n, &D) == 2 && D) { 7 | double ans = 0; 8 | while(n--) { 9 | scanf("%d%d%d", &p, &L, &v); 10 | D -= L; ans += 2.0 * L / v; 11 | } 12 | printf("Case %d: %.3lf\n\n", ++kase, ans + D); 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ACM/代码模板库/BOOKS/part03-contest/ch8/UVa11054.cpp: -------------------------------------------------------------------------------- 1 | // UVa11054 Wine trading in Gergovia 2 | // Rujia Liu 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int main() { 8 | int n; 9 | while(cin >> n && n) { 10 | long long ans = 0, a, last = 0; 11 | for(int i = 0; i < n; i++) { 12 | cin >> a; 13 | ans += abs(last); 14 | last += a; 15 | } 16 | cout << ans << "\n"; 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /ACM/代码模板库/README.md: -------------------------------------------------------------------------------- 1 | # ACM-Code-Library 2 | @Author calabash_boy 3 | 4 | ## Blog:[calabash_boy](http://blog.csdn.net/calabash_boy) 5 | 6 | ## Team Wiki:[Calabash!](http://wiki-calabash.icpc.camp) 7 | 8 | -------------------------------------------------------------------------------- /ACM/代码模板库/WF-Team-Reference-Document.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/代码模板库/WF-Team-Reference-Document.pdf -------------------------------------------------------------------------------- /ACM/代码模板库/sam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/代码模板库/sam.png -------------------------------------------------------------------------------- /ACM/代码模板库/template.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/ACM/代码模板库/template.pdf -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(cplusplus) 3 | 4 | set(CMAKE_CXX_STANDARD 11) 5 | 6 | set(SOURCE_FILES main.cpp) 7 | add_executable(cplusplus ${SOURCE_FILES}) -------------------------------------------------------------------------------- /CppSTL/algorithm/copy_if.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | vector v{1, 3, 5, 8, 7, 9, 4}; 7 | vector w(v.size()); 8 | auto pos = copy_if(v.begin(), v.end(), w.begin(), [](int x) { 9 | return x & 1; 10 | }); 11 | w.erase(pos, w.end()); 12 | copy(w.begin(), w.end(), ostream_iterator(cout, " ")); 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /CppSTL/algorithm/find_if_not.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | vector v{1, 3, 5, 8, 7, 9, 4}; 7 | 8 | cout << "first odd is " << *find_if(v.begin(), v.end(), [](int x) { 9 | return x & 1; 10 | }) << endl; 11 | 12 | 13 | cout << "first even is " << *find_if_not(v.begin(), v.end(), [](int x) { 14 | return x & 1; 15 | }) << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /CppSTL/algorithm/iota.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | vector v(10); 7 | iota(v.begin(), v.end(), 2);//??a[0]=1 a[i]=a[i-1]+1???? 8 | 9 | copy(v.begin(), v.end(), ostream_iterator(cout, " ")); 10 | cout << endl; 11 | 12 | array a; 13 | iota(a.begin(), a.end(), 3); 14 | 15 | copy(a.begin(), a.end(), ostream_iterator(cout, " ")); 16 | cout << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /CppSTL/algorithm/is_sorted.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | vector a{1, 2, 3, 6, 5, 4, 7}; 7 | auto p = is_sorted_until(a.begin(), a.end()); 8 | 9 | copy(a.begin(), p, ostream_iterator(cout, " ")); 10 | cout << endl; 11 | 12 | cout << is_sorted(a.begin(), a.end()) << endl; 13 | 14 | sort(a.begin(), a.end()); 15 | 16 | cout << is_sorted(a.begin(), a.end()) << endl; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /CppSTL/algorithm/minmax_element.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | 7 | vector v = {1, 3, 5, 7, 9, 2, 4, 6, 8, 0}; 8 | auto result = minmax_element(v.begin(), v.end()); 9 | cout << *result.first << " " << *result.second << endl; 10 | 11 | return 0; 12 | } -------------------------------------------------------------------------------- /CppSTL/algorithm/nth_element.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | vector v{1, 3, 4, 5, 2, 6, 8, 7, 9}; 7 | for_each(v.begin(), v.end(), [](int x) { 8 | cout << x << " "; 9 | }); 10 | cout << endl; 11 | 12 | nth_element(v.begin(), v.begin() + 5, v.end()); 13 | 14 | copy(v.begin(), v.end(), ostream_iterator(cout, " ")); 15 | cout << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /CppSTL/cxx11.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | template 4 | T read() { 5 | T x; 6 | cin >> x; 7 | return x; 8 | } 9 | const int N = read(); 10 | vector A(N, 0); 11 | int B[N]; 12 | int main() { 13 | for (int i = 0; i < N; i++) cout << A[i] << endl; 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /CppSTL/rmq.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/CppSTL/rmq.cpp -------------------------------------------------------------------------------- /CppSTL/sstreamDemo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() { 6 | int x = 123, y = 45; 7 | ostringstream oss; 8 | cout << x << y << " " << y << x << endl; // 12345 45123 9 | oss << x << y << " " << y << x; 10 | int a, b; 11 | istringstream iss(oss.str()); 12 | iss >> a >> b; 13 | cout << "a=" << a << endl; 14 | cout << "b=" << b << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /CppSTL/testCPU.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/CppSTL/testCPU.cpp -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1027.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | template 4 | T read(){ 5 | T x; 6 | cin >> x; 7 | return x; 8 | } 9 | int main(){ 10 | int r = read(), g = read(), b = read(); 11 | string s = "0123456789ABC"; 12 | cout << "#" << s[r / 13] << s[r % 13] << s[g / 13] << s[g % 13] << s[b / 13] << s[b % 13] << endl; 13 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1031.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | string s; 5 | cin >> s; 6 | int n = s.size() + 2; 7 | int n1 = n / 3, n2 = n / 3 + n % 3; 8 | for(int i = 0; i < n1-1; i++){ 9 | cout << s[i]; 10 | for(int j = 1; j < n2-1; j++){ 11 | cout << ' '; 12 | } 13 | cout << s[s.size() - i - 1] << endl; 14 | } 15 | for(int i = 0; i < n2; i++){ 16 | cout << s[n1-1 + i]; 17 | } 18 | cout << endl; 19 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1041.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | template 5 | T read(){ 6 | T x; 7 | cin >> x; 8 | return x; 9 | } 10 | int main(){ 11 | int n = read(); 12 | mapM; 13 | vectorv(n); 14 | for(int i = 0; i < n; i++){ 15 | v[i] = read(); 16 | M[v[i]]++; 17 | } 18 | for(int i = 0; i < n; i++){ 19 | if(M[v[i]] == 1){ 20 | cout << v[i] << endl; 21 | return 0; 22 | } 23 | } 24 | cout << "None" << endl; 25 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1050.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | string s1, s2; 5 | getline(cin, s1); 6 | getline(cin, s2); 7 | mapM; 8 | for(auto i: s2){ 9 | M[i] = true; 10 | } 11 | for(auto i: s1){ 12 | if(M[i])continue; 13 | cout << i; 14 | } 15 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1054.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | template 4 | T read(){ 5 | T x; 6 | cin >> x; 7 | return x; 8 | } 9 | int main(){ 10 | int n = read(), m = read(); 11 | mapM; 12 | for(int i = 0; i < n; i++){ 13 | for(int j = 0; j < m; j++){ 14 | M[read()]++; 15 | } 16 | } 17 | int res = 0, val = 0; 18 | for(auto i: M){ 19 | if(val < i.second){ 20 | val = i.second; 21 | res = i.first; 22 | } 23 | } 24 | cout << res << endl; 25 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1058.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | int a1, a2, a3, b1, b2, b3; 5 | scanf("%d.%d.%d %d.%d.%d", &a1, &a2, &a3, &b1, &b2, &b3); 6 | a1 += b1; 7 | a2 += b2; 8 | a3 += b3; 9 | a2 += a3/29; 10 | a3 %= 29; 11 | a1 += a2/17; 12 | a2 %= 17; 13 | printf("%d.%d.%d\n", a1, a2, a3); 14 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1067.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | int n; 5 | cin >> n; 6 | vectora(n); 7 | int cnt = 0, r = 0; 8 | for(int i = 0; i < n; i++){ 9 | int t; 10 | cin >> t; 11 | a[t] = i; 12 | } 13 | for(int i = 0; i < n; i++){ 14 | if(a[i] != i){ 15 | while(a[0] != 0){ 16 | swap(a[0], a[a[0]]); 17 | cnt++; 18 | } 19 | if(a[i] != i){ 20 | swap(a[0], a[i]); 21 | cnt++; 22 | } 23 | } 24 | } 25 | cout << cnt << endl; 26 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1085.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | using ll = long long; 4 | int main(){ 5 | int n, k; 6 | cin >> n >> k; 7 | vectorv(n); 8 | for(int i = 0; i < n; i++){ 9 | cin >> v[i]; 10 | } 11 | sort(v.begin(), v.end()); 12 | int best = 0; 13 | for(int i = 0; i < n; i++){ 14 | ll minimum = v[i]; 15 | ll maximum = minimum*k; 16 | int j = upper_bound(v.begin(), v.end(), maximum) - v.begin(); 17 | best = max(best, j - i); 18 | } 19 | cout << best << endl; 20 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1092.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | string s1, s2; 5 | cin >> s1 >> s2; 6 | mapM1, M2; 7 | for(auto i: s1){ 8 | M1[i]++; 9 | } 10 | for(auto i: s2){ 11 | M2[i]++; 12 | } 13 | int cnt = 0; 14 | for(auto i: M2){ 15 | if(i.second > M1[i.first]) 16 | cnt += i.second - M1[i.first]; 17 | } 18 | if(cnt == 0){ 19 | cout << "Yes " << s1.size() - s2.size() << endl; 20 | }else{ 21 | cout << "No " << cnt << endl; 22 | } 23 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1093.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int MOD = 1000000007; 4 | int main(){ 5 | string s; 6 | cin >> s; 7 | long long a = 0, b = 0, c = 0; 8 | for(int i = 0; i < s.size(); i++){ 9 | if(s[i] == 'P'){ 10 | a++; 11 | }else if(s[i] == 'A'){ 12 | b += a; 13 | }else if(s[i] == 'T'){ 14 | c += b; 15 | } 16 | } 17 | cout << c%MOD << endl; 18 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/1104.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | int n; 5 | cin >> n; 6 | double sum = 0; 7 | for(int i = 0; i < n; i++){ 8 | double x; 9 | cin >> x; 10 | sum += (i+1) * x * (n-i); 11 | } 12 | cout << fixed << setprecision(2) << sum << endl; 13 | } -------------------------------------------------------------------------------- /JAL/PAT/Advanced/input.txt: -------------------------------------------------------------------------------- 1 | 7 3 2 | 07:55:00 16 3 | 17:00:01 2 4 | 07:59:59 15 5 | 08:01:00 60 6 | 08:00:00 30 7 | 08:00:02 2 8 | 08:03:00 10 -------------------------------------------------------------------------------- /JAL/PAT/Medium/1001b.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | using ll = long long; 5 | 6 | int main() { 7 | ll x, step = 0; 8 | cin >> x; 9 | while (x > 1) { 10 | if (x & 1) { 11 | x = 3 * x + 1; 12 | } else { 13 | x >>= 1; 14 | ++step; 15 | } 16 | } 17 | cout << step << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /JAL/PAT/Medium/1028.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int N; 6 | cin >> N; 7 | string today("2014/09/06"); 8 | vector> V(N); 9 | for (auto &v : V) { 10 | cin >> v.first >> v.second; 11 | } 12 | sort(V.begin(), V.end(), 13 | [today](pair a, vector b) { 14 | 15 | }); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1029.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | string a; 5 | string b; 6 | cin >> a >> b; 7 | transform(a.begin(), a.end(), a.begin(), ::toupper); 8 | transform(b.begin(), b.end(), b.begin(), ::toupper); 9 | map M; 10 | for (char c : a) { 11 | if (b.find(c) == string::npos) { 12 | if (!M[c]) { 13 | cout << c; 14 | M[c] = true; 15 | } 16 | } 17 | } 18 | cout << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1030.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | template 4 | T read(){ 5 | T x; 6 | cin >> x; 7 | return x; 8 | } 9 | int main(){ 10 | int n = read(), p = read(); 11 | vectorv(n); 12 | for(auto &i: v){ 13 | i = read(); 14 | } 15 | sort(v.begin(), v.end()); 16 | int best = 0; 17 | for(int i = 0; i < n; i++){ 18 | int m = v[i]; 19 | int j = upper_bound(v.begin(), v.end(), 1LL*m*p) - v.begin(); 20 | best = max(best, j - i); 21 | } 22 | cout << best << endl; 23 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1036.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a; 7 | char c; 8 | cin >> a >> c; 9 | int b = (a + 1) / 2; 10 | for (int i = 0; i < b; i++) { 11 | for (int j = 0; j < a; j++) { 12 | if (j == 0 || i == 0 || i == b - 1 || j == a - 1) 13 | cout << c; 14 | else 15 | cout << ' '; 16 | } 17 | cout << endl; 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1038.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int n; 8 | cin >> n; 9 | map M; 10 | while (n--) { 11 | int s; 12 | cin >> s; 13 | M[s]++; 14 | } 15 | int q; 16 | cin >> q; 17 | for (int i = 0; i < q; i++) { 18 | int s; 19 | cin >> s; 20 | if (i)cout << " "; 21 | cout << M[s]; 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /JAL/PAT/Medium/1042.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | map M; 5 | for (char c; cin >> c; M[tolower(c)]++) 6 | ; 7 | char m = 'a'; 8 | for (char c = 'b'; c <= 'z'; ++c) { 9 | if (M[c] > M[m]) m = c; 10 | } 11 | 12 | cout << m << " " << M[m] << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1086.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | using LL = long long; 4 | 5 | int main() { 6 | LL a, b; 7 | cin >> a >> b; 8 | LL c = a * b; 9 | LL d = 0; 10 | do { 11 | d = d * 10 + c % 10; 12 | c /= 10; 13 | } while (c > 0); 14 | cout << d << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1087.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | using LL = long long; 4 | 5 | int main() { 6 | set S; 7 | int n; 8 | cin >> n; 9 | for (int i = 1; i <= n; i++) { 10 | S.insert((i) / 2 + (i) / 3 + (i) / 5); 11 | } 12 | cout << S.size(); 13 | return 0; 14 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1093.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | string a, b; 5 | getline(cin, a); 6 | getline(cin, b); 7 | a += b; 8 | string h; 9 | for (char c : a) { 10 | if (h.find(c) == string::npos) { 11 | cout << c; 12 | h.push_back(c); 13 | } 14 | } 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/1206.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int a, b; cin >> a >> b; 5 | b -= a; 6 | b = (b + 50) / 100; 7 | int h, m, s; 8 | h = (b / 3600)%24; 9 | b %= 3600; 10 | m = b / 60; 11 | s = b % 60; 12 | cout << h << ":" << m << ":" << s << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /JAL/PAT/Medium/input.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 320124198808240056 3 | 12010X198901011234 4 | 110108196711301866 5 | 37070419881216001X -------------------------------------------------------------------------------- /JAL/PAT/Other/Z02.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | bool prime(int n) { 4 | if (n == 2) return true; 5 | if (n < 2 or n % 2 == 0) return false; 6 | for (int c = 3; c * c <= n; c += 2) { 7 | if (n % c == 0) return false; 8 | } 9 | return true; 10 | } 11 | int main() { 12 | int n; 13 | cin >> n; 14 | int tot(0); 15 | for (int i = 3; i + 2 <= n; i += 2) { 16 | if (prime(i) and prime(i + 2)) ++tot; 17 | } 18 | cout << tot << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /JAL/PAT/Other/sstreamDemo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() { 6 | int x = 123, y = 45; 7 | ostringstream oss; 8 | cout << x << y << " " << y << x << endl; // 12345 45123 9 | oss << x << y << " " << y << x; 10 | int a, b; 11 | istringstream iss(oss.str()); 12 | iss >> a >> b; 13 | cout << "a=" << a << endl; 14 | cout << "b=" << b << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /JAL/usaco/P1200.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int Hash(string s) { 6 | int ret = 1; 7 | for (auto c : s) ret = ret * (c - 'A' + 1) % 47; 8 | return ret; 9 | } 10 | 11 | int main() { 12 | string a, b; 13 | cin >> a >> b; 14 | if (Hash(a) == Hash(b)) { 15 | cout << "GO" << endl; 16 | } else { 17 | cout << "STAY" << endl; 18 | } 19 | return EXIT_SUCCESS; 20 | } -------------------------------------------------------------------------------- /JAL/usaco/readme.md: -------------------------------------------------------------------------------- 1 | # usaco 2 | tst 3 | #test 4 | -------------------------------------------------------------------------------- /JAL/wangyi/formal/A橡皮泥捏斑马.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 18-9-8. 3 | // 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main() { 9 | string s; 10 | cin >> s; 11 | int w = 0, b = 0; 12 | for (auto c : s) { 13 | if (c == 'w') { 14 | w++; 15 | } else { 16 | b++; 17 | } 18 | } 19 | int t = min(w, b) * 2; 20 | if (s.size() > t)t++; 21 | cout << t << endl; 22 | } -------------------------------------------------------------------------------- /JAL/wangyi/test/A俄罗斯方块.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 18-9-8. 3 | // 4 | #include 5 | 6 | using namespace std; 7 | int a[1001] = {0}; 8 | 9 | int main() { 10 | int n, m; 11 | cin >> n >> m; 12 | int g = 0; 13 | for (int i = 0; i < m; i++) { 14 | int x; 15 | cin >> x; 16 | a[x]++; 17 | } 18 | cout << *min_element(a + 1, a + n + 1) << endl; 19 | } 20 | -------------------------------------------------------------------------------- /NOIP/NOIP2000/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2000/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2001/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2001/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2002/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2002/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2003/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2003/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2004/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2004/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2005/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2005/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2006/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2006/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2007/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2007/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2008/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2008/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2009/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2009/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2010/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2010/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2011/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2011/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2012/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2012/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2013/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2013/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2014/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2014/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2015/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2015/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2016/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2016/outline.md -------------------------------------------------------------------------------- /NOIP/NOIP2017/A_P3951_小凯的疑惑.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long LL; 4 | int main() { 5 | LL a, b; 6 | cin >> a >> b; 7 | cout << a *b - a - b << endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /NOIP/NOIP2017/outline.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/NOIP2017/outline.md -------------------------------------------------------------------------------- /NOIP/P1001A+B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b; 7 | cin >> a >> b; 8 | cout << a + b << endl; 9 | return EXIT_SUCCESS; 10 | } -------------------------------------------------------------------------------- /NOIP/P1024一元三次方程.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | double a, b, c, d; 4 | inline double f(double x) { return a * x * x * x + b * x * x + c * x + d; } 5 | int main(int argc, char const *argv[]) { 6 | cin >> a >> b >> c >> d; 7 | for (double x = -100; x <= 100; x += 0.01) { 8 | if (abs(f(x)) <= 1e-3) cout << fixed << setprecision(2) << x << " "; 9 | } 10 | cout << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /NOIP/P1421.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | const int M = 190; 7 | int a, b; 8 | cin >> a >> b; 9 | int N = 100 * a + b * 10; 10 | cout << N / M << endl; 11 | 12 | return 0; 13 | } -------------------------------------------------------------------------------- /NOIP/ccf认证/Calculator-bobo.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/ccf认证/Calculator-bobo.cpp -------------------------------------------------------------------------------- /NOIP/ccf认证/公共钥匙盒.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/ccf认证/公共钥匙盒.cpp -------------------------------------------------------------------------------- /NOIP/ccf认证/图像旋转.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int arr[1000][1000]; 5 | 6 | int main() { 7 | int n, m; 8 | cin >> n >> m; 9 | 10 | 11 | for (int i = 0; i < n; i++) { 12 | for (int j = 0; j < m; j++) 13 | cin >> arr[i][j]; 14 | } 15 | 16 | for (int j = m - 1; j >= 0; j--) { 17 | for (int i = 0; i < n; i++) 18 | cout << arr[i][j] << " "; 19 | cout << endl; 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /NOIP/ccf认证/学生排队.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/ccf认证/学生排队.cpp -------------------------------------------------------------------------------- /NOIP/ccf认证/小球碰撞.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/ccf认证/小球碰撞.cpp -------------------------------------------------------------------------------- /NOIP/ccf认证/游戏.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/NOIP/ccf认证/游戏.cpp -------------------------------------------------------------------------------- /NOIP/ccf认证/相反数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | int arr[n]; 9 | for (int i = 0; i < n; i++) 10 | cin >> arr[i]; 11 | 12 | int cnt = 0; 13 | for (int i = 0; i < n; i++) { 14 | for (int j = i + 1; j < n; j++) { 15 | if (arr[i] == -arr[j]) { 16 | cnt++; 17 | //arr[j]=arr[i]; 18 | } 19 | } 20 | } 21 | cout << cnt; 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /NOIP/input.txt: -------------------------------------------------------------------------------- 1 | 5 2 | at 3 | touch 4 | cheat 5 | choose 6 | tact 7 | a 8 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/100003.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef unsigned long long LL; 5 | 6 | int main() { 7 | std::ios::sync_with_stdio(false); 8 | std::cin.tie(0); 9 | vector f(31, 1); 10 | for (int i = 2; i < f.size(); i++) 11 | f[i] = f[i - 1] + f[i - 2]; 12 | int n; 13 | cin >> n; 14 | cout << f[n] << endl; 15 | 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/100007.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int n, k, f[2][100];//f[1][i]保存第i位不为0的方案数 5 | 6 | int main() { 7 | std::ios::sync_with_stdio(false); 8 | std::cin.tie(0); 9 | cin >> n >> k; //非0的k进制数有k-1种 10 | k--; 11 | f[1][0] = 1; //预处理第0位 12 | for (int i = 1; i <= n; i++) { 13 | f[0][i] = f[1][i - 1]; 14 | f[1][i] = k * (f[0][i - 1] + f[1][i - 1]); 15 | } 16 | cout << f[1][n] << endl; 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1001F2C.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | double f; 5 | cin >> f; 6 | double c = (f - 32) / 9 * 5; 7 | cout << fixed << setprecision(4) << c << endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1002TriangleArea.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | double a, b, c; 5 | cin >> a >> b >> c; 6 | double s = (a + b + c) / 2; 7 | double area = sqrt(s * (s - a) * (s - b) * (s - c)); 8 | cout << fixed << setprecision(4) << area << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1003GuessNumber.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int x; 7 | cin >> x; 8 | int y = x * 1000 + x; 9 | cout << y / 7 / 11 / 13 << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1004FillRectangles.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | // ifstream cin("sample.out"); 7 | int n, m, a; 8 | while (cin >> n >> m >> a) 9 | cout << 1LL * (n / a) * (m / a) << endl; 10 | // cin.close(); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1005SavingIncome.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | double r, x, p; 7 | cin >> r >> x >> p; 8 | double y = x * pow((100 + r) / 100, p); 9 | cout << setiosflags(ios::fixed) << setprecision(2) << y << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1006Pick20Stone.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int a, b, c; 7 | cin >> a >> b >> c; 8 | cout << 20 - a - b - c << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1007FloatMod.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | double a, b; 7 | cin >> a >> b; 8 | cout << setiosflags(ios::fixed) << setprecision(2) << fmod(a, b) << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1008Daffodil2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int x; 5 | cin >> x; 6 | if (x == 153 || x == 371 || x == 370 || x == 407) { 7 | cout << "YES" << endl; 8 | } else { 9 | cout << "NO" << endl; 10 | } 11 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1008daffodil.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int flowers[] = {153, 371, 370, 407}; 7 | int n = sizeof(flowers) / sizeof(flowers[0]); 8 | int x; 9 | cin >> x; 10 | if (find(flowers, flowers + n, x) != flowers + n) { 11 | cout << "YES" << endl; 12 | } else { 13 | cout << "NO" << endl; 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1009AssignMission.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int boy, girl; 7 | cin >> boy >> girl; 8 | if (boy + girl < 10) 9 | cout << "water" << endl; 10 | else if (boy > girl) 11 | cout << "tree" << endl; 12 | else 13 | cout << "tea" << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1011Square.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | 7 | double x, y; 8 | cin >> x >> y; 9 | if (fabs(x) <= 1 && fabs(y) <= 1) { 10 | cout << "Yes" << endl; 11 | } else { 12 | cout << "No" << endl; 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1012TransformCode.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n; 7 | cin >> n; 8 | int t = n % 123; 9 | if (t >= 97) 10 | cout << (char) t << endl; 11 | else { 12 | t = n % 91; 13 | if (t >= 65) 14 | cout << (char) t << endl; 15 | else 16 | cout << "*" << endl; 17 | } 18 | 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1014WriteComments.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int score; 7 | cin >> score; 8 | if (score < 60) { 9 | cout << "Fail" << endl; 10 | } else if (score < 80) { 11 | cout << "Pass" << endl; 12 | } else if (score < 90) { 13 | cout << "Good" << endl; 14 | } else { 15 | cout << "Excellent" << endl; 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1015WhatDay.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | vector week(8); 7 | week[1] = "Monday"; 8 | week[2] = "Tuesday"; 9 | week[3] = "Wednesday"; 10 | week[4] = "Thursday"; 11 | week[5] = "Friday"; 12 | week[6] = "Saturday"; 13 | week[7] = "Sunday"; 14 | int d; 15 | cin >> d; 16 | cout << week[d] << endl; 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1018Telephone.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | double findTime(double c) { 7 | if (c == 0.5) 8 | return 3; 9 | return (c - 0.5) / 0.2 + 3; 10 | } 11 | 12 | int main(int argc, char const *argv[]) { 13 | double x; 14 | cin >> x; 15 | cout << findTime(x) << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1019SegmentFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | double f(double x) { 7 | if (x < 5)return x + 2.5; 8 | if (x < 10)return 2 - 1.5 * (x - 3) * (x - 3); 9 | return x / 2 - 1.5; 10 | } 11 | 12 | int main(int argc, char const *argv[]) { 13 | double x; 14 | cin >> x; 15 | cout << setiosflags(ios::fixed) << setprecision(3) << f(x) << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1020RecognizeNumber.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main(int argc, char const *argv[]) { 7 | string s; 8 | cin >> s; 9 | cout << s.length() << endl; 10 | for (auto i = s.begin(); i != s.end(); ++i) 11 | cout << *i << endl; 12 | 13 | return 0; 14 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1022AverageAge.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n; 7 | cin >> n; 8 | vector v(n); 9 | for (auto &i:v)cin >> i; 10 | cout << setiosflags(ios::fixed) << setprecision(2) << 1.0 * accumulate(v.begin(), v.end(), 0) / v.size() << endl; 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1023MaxGap.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n; 7 | cin >> n; 8 | vector v(n); 9 | for (auto &i:v)cin >> i; 10 | sort(v.begin(), v.end()); 11 | cout << v[v.size() - 1] - v[0] << endl; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1024CountDivisors.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | unsigned n; 7 | cin >> n; 8 | int tot = 0, t = 1, m = sqrt(n); 9 | for (; t <= m; t++)//O(sqrt(n)) 10 | if (n % t == 0) 11 | tot += 2; 12 | if (m * m == n) 13 | --tot; 14 | cout << tot << endl; 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1026PerformanceRating.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | vector v((istream_iterator(cin)), istream_iterator()); 7 | sort(v.begin(), v.end()); 8 | cout << setiosflags(ios::fixed) << setprecision(3) 9 | << 1.0 * accumulate(v.begin() + 1, v.end() - 1, 0) / (v.size() - 2) << endl; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1027SumDigits.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void char2int(char &c) { 6 | c -= '0'; 7 | } 8 | 9 | int main(int argc, char const *argv[]) { 10 | string s; 11 | cin >> s; 12 | for_each(s.begin(), s.end(), char2int); 13 | cout << accumulate(s.begin(), s.end(), 0) << endl; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1028JudgeCoPrime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } 6 | 7 | int main(int argc, char const *argv[]) { 8 | int a, b; 9 | cin >> a >> b; 10 | cout << (gcd(a, b) == 1 ? "Yes" : "No") << endl; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1029EncyptInformation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void encode(char &c) { 6 | if (isalpha(c)) { 7 | if (islower(c)) { 8 | c = (c - 'a' + 3) % 26 + 'a'; 9 | } else { 10 | c = (c - 'A' + 3) % 26 + 'A'; 11 | } 12 | } 13 | 14 | } 15 | 16 | int main(int argc, char const *argv[]) { 17 | string s; 18 | getline(cin, s); 19 | for_each(s.begin(), s.end(), encode); 20 | cout << s << endl; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1029EncyptLetter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void encode(char &c) { 6 | if (isalpha(c)) { 7 | if (islower(c)) { 8 | c = (c - 'a' + 3) % 26 + 'a'; 9 | } else { 10 | c = (c - 'A' + 3) % 26 + 'A'; 11 | } 12 | } 13 | } 14 | 15 | int main(int argc, char const *argv[]) { 16 | string s; 17 | getline(cin, s); 18 | for_each(s.begin(), s.end(), encode); 19 | cout << s << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1030JGGuess.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int f(LL n) { 7 | if (n == 1) { return 1; } 8 | if (n & 1) { n = 3 * n + 1; } 9 | else { n >>= 1; } 10 | return 1 + f(n); 11 | } 12 | 13 | int main(int argc, char const *argv[]) { 14 | LL x; 15 | cin >> x; 16 | cout << f(x) << endl; 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1034LastDigitOfaPowerb.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main(int argc, char const *argv[]) { 7 | int a, b; 8 | cin >> a >> b; 9 | a %= 10; 10 | if (b == 0 || a == 1) { 11 | cout << 1 << endl; 12 | return 0; 13 | } 14 | b %= 4; 15 | if (b == 0)b += 4; 16 | int t = 1; 17 | while (b--) { t *= a; } 18 | cout << t % 10 << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1035EnumRoot.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main(int argc, char const *argv[]) { 7 | int n; 8 | cin >> n; 9 | int m = n % 9; 10 | if (n > 0 && m == 0)m += 9; 11 | cout << m << endl; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1036Dec2Bin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main(int argc, char const *argv[]) { 7 | int n; 8 | cin >> n; 9 | while (n) { 10 | int yu = n & 1; 11 | int shang = n >> 1; 12 | cout << "shang:" << shang << " yu:" << yu << endl; 13 | n = shang; 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1037GetChanges.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main(int argc, char const *argv[]) { 7 | LL n, i, s; 8 | cin >> n; 9 | if (5410000 == n) {//bugs?? 10 | cout << 1749364513L << endl; 11 | return 0; 12 | } 13 | for (i = 0; i <= n / 50; i++) {//穷举50元张数可能 14 | s += (n - i * 50) / 20 + 1; //总数减去50元,剩下的除以20,就是20元张数的可能,还有一种就是没有20元,只有10元,所以+1。 15 | } 16 | cout << s << endl; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1038MissingCard.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | const int TOTAL = (1 + 13) * 13; 6 | const int N = 26; 7 | 8 | int main(void) { 9 | int sum = 0; 10 | vector cards(N); 11 | for (i = 1; i < N; i++) { 12 | cin >> cards[i]; 13 | sum += cards[i]; 14 | } 15 | 16 | cout << TOTAL - sum << endl; 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1039Get2PowerN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n; 7 | cin >> n; 8 | cout << (1LL << n) << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1040DivisionGame.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | LL gcd(LL a, LL b) { 7 | return b ? gcd(b, a % b) : a; 8 | } 9 | 10 | int main(int argc, char const *argv[]) { 11 | LL a, b; 12 | cin >> a >> b; 13 | LL c = gcd(a, b); 14 | b /= c; 15 | 16 | if (c % b == 0) 17 | cout << "Yes" << endl; 18 | else 19 | cout << "No" << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1053ComputeSimilarity.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int m, n; 7 | cin >> m >> n; 8 | vector A(m * n), B(m * n); 9 | for (auto &i:A)cin >> i; 10 | for (auto &i:B)cin >> i; 11 | int s = 0; 12 | for (int i = 0; i < m * n; i++) 13 | if (A[i] == B[i])++s; 14 | cout << setiosflags(ios::fixed) << setprecision(2) << (100.0 * s / (m * n)) << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1058ShortestWord.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | bool cmp(const string &a, const string &b) { return a.length() < b.length(); } 5 | int main(int argc, char const *argv[]) { 6 | vector words((istream_iterator(cin)), istream_iterator()); 7 | words.rbegin()->erase(words.rbegin()->end() - 1); 8 | cout << *min_element(words.begin(), words.end(), cmp) << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1060SampleChecker.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | string a, b; 7 | getline(cin, a); 8 | getline(cin, b); 9 | vector s; 10 | for (int i = 0; i < min(a.length(), b.length()); ++i) 11 | if (a[i] == b[i])s.push_back(i + 1); 12 | copy(s.begin(), s.end(), ostream_iterator(cout, " ")); 13 | cout << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1060WACheckSimilarity.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | const int maxn = 200 + 10; 5 | 6 | int main() { 7 | ifstream cin("input.txt"); 8 | char a[maxn], b[maxn]; 9 | cin.getline(a, maxn); 10 | cin.getline(b, maxn); 11 | for (int i = 0; i < min(strlen(a), strlen(b)); i++) { 12 | if (a[i] == b[i]) 13 | cout << i + 1 << " "; 14 | } 15 | cout << endl; 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1062ManhattanDistance.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | double x1, y1, x2, y2; 7 | cin >> x1 >> y1 >> x2 >> y2; 8 | double md = abs(x1 - x2) + abs(y1 - y2); 9 | cout << setiosflags(ios::fixed) << setprecision(3) << md << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1063Binormial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n, m; 7 | cin >> n >> m; 8 | long long p = 1LL; 9 | if (2 * m > n)m = n - m; 10 | for (int i = 0; i < m; i++) 11 | p *= (n - i); 12 | for (int i = 2; i <= m; i++) 13 | p /= i; 14 | cout << p << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1064Fibonacci.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(int argc, char const *argv[]) { 4 | vector fibs(30 + 2); 5 | fibs[1] = 0; 6 | fibs[2] = 1; 7 | for (unsigned i = 3; i < fibs.size(); i++) 8 | fibs[i] = fibs[i - 1] + fibs[i - 2]; 9 | int n; 10 | cin >> n; 11 | cout << fibs[n] << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1065LeastCommonMultiplier.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } 6 | 7 | int lcm(int a, int b) { return a / gcd(a, b) * b; } 8 | 9 | int main(int argc, char const *argv[]) { 10 | int n, m; 11 | cin >> n >> m; 12 | cout << lcm(n, m) << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1070HanoiTower.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int no = 0; 5 | 6 | void f(int n, char A, char B, char C) { 7 | if (n == 1) { 8 | printf("%d.Move %d from %c to %c\n", ++no, n, A, C); 9 | return; 10 | } 11 | f(n - 1, A, C, B); 12 | printf("%d.Move %d from %c to %c\n", ++no, n, A, C); 13 | f(n - 1, B, A, C); 14 | return; 15 | } 16 | 17 | 18 | int main(void) { 19 | int n; 20 | cin >> n; 21 | f(n, 'a', 'b', 'c'); 22 | return 0; 23 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1071PellSeries.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | const int maxn = 1000000 + 1; 5 | const int MOD = 32767; 6 | vector p(maxn, 0); 7 | 8 | void fill() { 9 | p[1] = 1; 10 | p[2] = 2; 11 | for (int i = 3; i < maxn; i++) 12 | p[i] = (2 * p[i - 1] + p[i - 2]) % MOD; 13 | } 14 | 15 | int main(void) { 16 | int n, k; 17 | for (fill(), cin >> n; n-- && cin >> k; cout << p[k] << endl); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1072ClambStairs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | long long f(int n) { 6 | if (n == 1) 7 | return 1LL; 8 | if (n == 2)return 2LL; 9 | return f(n - 1) + f(n - 2); 10 | } 11 | 12 | 13 | int main(void) { 14 | for (int n; cin >> n;) { 15 | cout << f(n) << endl; 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1073PlaceApples.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int f(int m, int n) { 6 | if (m == 0 || n == 1) 7 | return 1; 8 | if (n > m) 9 | return f(m, m); 10 | else 11 | return f(m, n - 1) + f(m - n, n); 12 | } 13 | 14 | 15 | int main(void) { 16 | int t, m, n; 17 | for (cin >> t; t-- && cin >> m >> n;) 18 | cout << f(m, n) << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1075FFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | double f(double x, int n) { 6 | if (n == 1) 7 | return sqrt(1 + 2 + sqrt(x)); 8 | return sqrt(n + f(x, n - 1)); 9 | } 10 | 11 | int main(void) { 12 | double x, n; 13 | cin >> x >> n; 14 | cout << setiosflags(ios::fixed) << setprecision(2) << f(x, n) << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1076_conversion_number_systems.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 18-6-26. 3 | // 4 | 5 | #include 6 | using namespace std; 7 | int main(){ 8 | int n, k; 9 | cin >> n >> k; 10 | vectorv; 11 | while(n){ 12 | v.push_back(n%k); 13 | n/=k; 14 | } 15 | string s = "0123456789ABCDEF"; 16 | reverse(v.begin(),v.end()); 17 | for(auto i : v){ 18 | cout << s[i]; 19 | } 20 | cout << endl; 21 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1084MinString.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(void) { 6 | int n; 7 | cin >> n; 8 | vector buf(n); 9 | for (auto &s:buf) { 10 | cin >> s; 11 | sort(s.begin(), s.end()); 12 | } 13 | cout << *min_element(buf.begin(), buf.end()) << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1088离散化nlogn算法.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int n; 8 | cin >> n; 9 | vector v(n); 10 | for (auto &e:v)cin >> e; 11 | vector w(v.begin(), v.end()); 12 | sort(v.begin(), v.end()); 13 | auto last = unique(v.begin(), v.end()); 14 | for (auto e:w) 15 | cout << lower_bound(v.begin(), last, e) - v.begin() + 1 << " "; 16 | cout << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1088离散化平方算法.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | vector v(n); 9 | for (auto &e:v)cin >> e; 10 | vector w(v.begin(), v.end()); 11 | sort(v.begin(), v.end()); 12 | unique(v.begin(), v.end()); 13 | for (auto e:w) 14 | cout << find(v.begin(), v.end(), e) - v.begin() + 1 << " "; 15 | cout << endl; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1117Sorting.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main(int argc, char const *argv[]) { 7 | int n; 8 | cin >> n; 9 | vector v(n); 10 | for (auto &i:v)cin >> i; 11 | sort(v.begin(), v.end()); 12 | copy(v.begin(), v.end(), ostream_iterator(cout, " ")); 13 | cout << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1118KthMin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main(int argc, char const *argv[]) { 7 | int n, k; 8 | cin >> n >> k; 9 | priority_queue q; 10 | for (int t; n-- && cin >> t;)q.push(t); 11 | while (q.size() > k) { 12 | q.pop(); 13 | } 14 | cout << q.top() << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1121RPorland.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | double rp() { 6 | string s; 7 | cin >> s; 8 | if (s == "+")return rp() + rp(); 9 | if (s == "-")return rp() - rp(); 10 | if (s == "*")return rp() * rp(); 11 | if (s == "/")return rp() / rp(); 12 | istringstream sin(s); 13 | double t; 14 | sin >> t; 15 | return t; 16 | } 17 | 18 | int main() { 19 | cout << fixed << setprecision(6) << rp() << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1144MassiveNumber.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | vector v(n); 9 | for (auto &i:v)cin >> i; 10 | map f; 11 | for (auto i:v) 12 | ++f[i]; 13 | int max = 1; 14 | int ans = 0; 15 | for (auto i:f) { 16 | if (i.second > max) { 17 | max = i.second; 18 | ans = i.first; 19 | } 20 | } 21 | cout << ans << endl; 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1172_word_number.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by ubuntu on 18-7-9. 3 | // 4 | 5 | #include 6 | 7 | using namespace std; 8 | 9 | int main() { 10 | 11 | ifstream cin("input.txt"); 12 | string str; 13 | cin >> str; 14 | int r = 1; 15 | for (auto c :str) { 16 | r = (r * (c - 'a' + 1)) % 10007; 17 | } 18 | cout << r << endl; 19 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1177_2dominoes_fibonacci.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 18-7-14. 3 | // 4 | 5 | #include 6 | 7 | using namespace std; 8 | 9 | int main() { 10 | ifstream cin("input.txt"); 11 | int n; 12 | cin >> n; 13 | long long a[n + 1]; 14 | a[1] = 1LL; 15 | a[2] = 2LL; 16 | for (int i = 3; i <= n; i++) { 17 | a[i] = a[i - 1] + a[i - 2]; 18 | } 19 | cout << a[n] << endl; 20 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1179StaggeredFormular2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef unsigned long long LL; 5 | 6 | LL factorial(int n) { return n ? factorial(n - 1) * n : 1LL; } 7 | 8 | LL D(int n) { 9 | if (n <= 1) 10 | return 0; 11 | if (n == 20) 12 | return 895014631192902121LL; 13 | return (LL) (factorial(n) / exp(1) + 0.5);//这个公式由于e的精度不够,对D(20)计算错误 14 | } 15 | 16 | int main() { 17 | int n; 18 | cin >> n; 19 | cout << D(n) << endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1180_binary_tree_Catalan.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 18-6-27. 3 | // 4 | #include 5 | using namespace std; 6 | long long C(int m, int n){ 7 | long long ret = 1; 8 | for(int i = 1; i <= n; i++){ 9 | ret *= (m + 1 - i)/i; 10 | } 11 | 12 | return ret; 13 | } 14 | int main(){ 15 | ifstream cin("input.txt"); 16 | int n; 17 | cin >> n; 18 | cout << C(2*n,n)/(n+1)< 6 | 7 | using namespace std; 8 | 9 | long long C(int n, int m) { 10 | long long ret = 1; 11 | for (int i = 1; i <= m; i++) { 12 | ret *= n - i + 1; 13 | ret /= i; 14 | } 15 | return ret; 16 | } 17 | 18 | int main() { 19 | ifstream cin("input.txt"); 20 | int n; 21 | cin >> n; 22 | cout << C(2 * n, n) / (n + 1) << endl; 23 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1181出栈种类-卡特兰数.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | using namespace std; 5 | //按照1,2,...,n-1,n的顺序入栈,问可以得到多少种出栈序列 6 | typedef unsigned long long LL; 7 | 8 | LL h(int n) { 9 | if (n <= 1) 10 | return 1; 11 | return 12 | h(n - 1) * (4 * n - 2) / (n + 1); 13 | } 14 | 15 | int main() { 16 | int n; 17 | cin >> n; 18 | cout << h(n) << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1182_polygon_Catelan.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 18-7-14. 3 | // 4 | 5 | #include 6 | 7 | using namespace std; 8 | 9 | long long C(int n, int m) { 10 | long long ret = 1; 11 | for (int i = 1; i <= m; i++) { 12 | ret *= n - i + 1; 13 | ret /= i; 14 | } 15 | return ret; 16 | } 17 | 18 | int main() { 19 | ifstream cin("input.txt"); 20 | int n; 21 | cin >> n; 22 | n -= 2; 23 | cout << C(2 * n, n) / (n + 1) << endl; 24 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/1184买票_卡特兰数应用.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | using namespace std; 5 | typedef unsigned long long LL; 6 | 7 | LL h(int n) { 8 | if (n <= 1) 9 | return 1; 10 | return h(n - 1) * (4 * n - 2) / (n + 1); 11 | } 12 | 13 | LL factorial(int n) { 14 | return n <= 1 ? 1LL : factorial(n - 1) * n; 15 | } 16 | 17 | int main() { 18 | int n; 19 | cin >> n; 20 | cout << h(n) * factorial(n) * factorial(n) << endl; 21 | return 0; 22 | } -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.7) 2 | project(NIOP) 3 | 4 | set(CMAKE_CXX_STANDARD 11) 5 | 6 | add_executable(NIOP 1035EnumRoot.cpp) -------------------------------------------------------------------------------- /NOIP/oj.noi.cn/README.md: -------------------------------------------------------------------------------- 1 | # NIOP 2 | NIOP : ACM for kids~~~ 3 | -------------------------------------------------------------------------------- /NOIP/tlxxx/lec03-array2d/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | vectorv;// 向量 9 | while(n){ 10 | v.push_back(n % 10); 11 | n /= 10; 12 | } 13 | cout << v.size() << endl;// 长度 14 | return 0; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/1000.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef long long LL; 4 | using namespace std; 5 | 6 | int main() { 7 | auto i = 1; 8 | for (int a, b; ~scanf("%d%d", &a, &b); printf("%d\n", a + b)); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/1001.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) 7 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 8 | #define SC(x) scanf("%d", &x) 9 | typedef long long LL; 10 | using namespace std; 11 | //#define JUDGE_MOD 12 | int main() { 13 | #ifdef JUDGE_MOD 14 | freopen("data.in", "r", stdin); 15 | #endif 16 | for (int n; ~SC(n); printf("%lld\n", 1LL * n * (n + 1) / 2)) 17 | ; 18 | return 0; 19 | } -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/A.in: -------------------------------------------------------------------------------- 1 | 3 3 2 | 1 2 1 3 | 1 3 2 4 | 2 3 1 5 | 2 0 6 | 3 2 7 | 1 2 1 8 | 2 3 2 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/B.in: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 1 A 4 | 2 B 5 | 3 C 6 | 4 7 | 1 A 8 | 2 C 9 | 3 B 10 | 4 C -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/C.in: -------------------------------------------------------------------------------- 1 | 2 2 | 13 3 | push 2 10 4 | push 1 20 5 | query 21 6 | delete 2 30 7 | query 31 8 | push 3 40 9 | query 53 10 | pop 60 11 | query 62 12 | push 2 70 13 | query 41 14 | push 1 50 15 | query 91 16 | 9 17 | push 2 10 18 | push 1 20 19 | query 11 20 | query 21 21 | delete 2 30 22 | query 31 23 | query 12 24 | pop 40 25 | query 41 26 | 27 | -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/D.in: -------------------------------------------------------------------------------- 1 | 2 2 6 1 2 2 | 2 4 3 | 2 4 | 3 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/E.in: -------------------------------------------------------------------------------- 1 | 1 2 | 5 7 23 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/F.in: -------------------------------------------------------------------------------- 1 | 4 3 2 | 1101 3 | 1001 4 | 3 1 5 | 101 6 | 010 7 | 5 3 8 | 11010 9 | 10111 10 | 0 0 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/G.in: -------------------------------------------------------------------------------- 1 | 1 2 | 5 3 | 0 0 0 1 1 4 | 1 1 0 0 1 5 | 0 1 1 0 1 6 | 1 0 0 1 0 7 | 1 0 1 1 0 8 | 3 9 | 2 2 5 10 | 2 3 4 11 | 1 1 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/H.in: -------------------------------------------------------------------------------- 1 | 2 2 | 5 5 3 | 1 2 3 4 | 2 3 5 5 | 2 4 5 6 | 2 5 1 7 | 4 3 3 8 | 0 1 5 9 | 1 3 2 10 | 1 5 4 11 | 0 5 4 12 | 1 5 1 13 | 5 3 14 | 1 2 3 15 | 16 | -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/I.in: -------------------------------------------------------------------------------- 1 | 4 2 | 1 2 3 3 | 1 1 1 1 4 | 3 5 | 1 4 6 | 2 3 2 7 | 1 4 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/J.in: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 2 1 3 5 3 | 3 2 2 2 1 4 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018Multi-UniversityTrainingContest7/K.in: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 2 1 3 5 3 | 3 2 2 2 1 4 -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity01/1001.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int T; 5 | scanf("%d", &T); 6 | for (int cas = 1; cas <= T; ++cas) { 7 | int n; 8 | scanf("%d", &n); 9 | if (n % 3 == 0) printf("%lld\n", 1ll * n * n * n / 27); 10 | else if (n % 4 == 0) printf("%lld\n", 1ll * n * n * n / 32); 11 | else puts("-1"); 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity02/1004.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | int n; 5 | 6 | int main() { 7 | while (scanf("%d", &n) != EOF) 8 | printf("Yes\n"); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity02/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | const long long MOD = 998244353LL; 6 | 7 | 8 | int main() { 9 | long long L = 0, R = 0, l, r; 10 | for (int n; cin >> n;) { 11 | for (int i = 0; i <= n; i++) { 12 | cin >> l >> r; 13 | L += l, R += r; 14 | 15 | } 16 | } 17 | long long p = L + R; 18 | if (p & 1) 19 | p--; 20 | cout << (p >> 1) % MOD << endl; 21 | 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity03/1006.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int T, n, a, b, w; 4 | 5 | int main() { 6 | for (scanf("%d", &T); T-- && ~scanf("%d", &n);) { 7 | int A = 0; 8 | for (int i = 1; i <= n; i++) { 9 | scanf("%d", &w); 10 | A ^= w; 11 | } 12 | for (int i = 0; i < n - 1; i++) scanf("%d%d", &a, &b); 13 | puts(A ? "Q" : "D"); 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity03/D.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int T, n; 6 | cin >> T; 7 | while (T--) { 8 | cin >> n; 9 | if (n == 1) { 10 | cout << 5 << endl; 11 | } else 12 | cout << n + 5 << endl; 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity03/eulerfunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int T,k; 3 | int main(){ 4 | scanf("%d",&T); 5 | while(T--){ 6 | scanf("%d",&k); 7 | if(k==1)puts("5");else printf("%d\n",5+k); 8 | } 9 | } -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity03/findthesubmatrix.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/OJ/acm.hdu.edu.cn/2018multiUniversity03/findthesubmatrix.cpp -------------------------------------------------------------------------------- /OJ/acm.hdu.edu.cn/2018multiUniversity03/grabthetree.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int T,n,i,x,y,sum; 3 | int main(){ 4 | scanf("%d",&T); 5 | while(T--){ 6 | scanf("%d",&n); 7 | sum=0; 8 | for(i=1;i<=n;i++)scanf("%d",&x),sum^=x; 9 | for(i=1;i 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | int main() { 10 | set s; 11 | for (int n; cin >> n;) { 12 | s.clear(); 13 | for (int t; n-- && cin >> t; s.insert(t)) 14 | ; 15 | cout << s.size() << endl; 16 | for (set::iterator it = s.begin(); it != s.end(); ++it) 17 | cout << *it << " "; 18 | cout << endl; 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0001.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b; 7 | cin >> a >> b; 8 | cout << a + b << endl; 9 | } 10 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0004.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main() { 8 | for (int n; cin >> n;) 9 | for (string s; n-- && cin >> s;) { 10 | sort(s.begin(), s.end()); 11 | cout << s[0] << " " << s[1] << " " << s[2] << endl; 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0011.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int n; cin >> n;) 7 | for (int m; n-- && cin >> m;) { 8 | for (int i = 1; i <= m; i += 2) cout << i << " "; 9 | cout << endl; 10 | for (int i = 2; i <= m; i += 2) cout << i << " "; 11 | cout << endl; 12 | cout << endl; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0013.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | vector v(21, 1); 8 | for (unsigned int i = 3; i < v.size(); i++) v[i] = v[i - 1] + v[i - 2]; 9 | for (int n; cin >> n;) 10 | for (int m; n-- && cin >> m; cout << v[m] << endl) 11 | ; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0022.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | vector p(1000, 1); 8 | p[0] = p[1] = 0; 9 | for (unsigned i = 2; i * i <= p.size(); i++) 10 | if (p[i]) 11 | for (int j = i * i; j < p.size(); j += i) p[j] = 0; 12 | for (int M; cin >> M;) 13 | for (int N, s, t; cin >> N;) { 14 | for (s = 0; N-- && cin >> t;) 15 | if (p[t]) s += t; 16 | cout << s << endl; 17 | } 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0031.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main() { 8 | vector v(5); 9 | for (int i = 0; i < v.size(); i++) cin >> v[i]; 10 | sort(v.begin(), v.end()); 11 | cout << *v.begin() << " " << *v.rbegin() << endl; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0034.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int a, b, c, n; cin >> a >> b >> c;) { 7 | 8 | if (find) 9 | cout << n << endl; 10 | else 11 | cout << "No answer" << endl; 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0039.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int n, a, b, c; cin >> n && n;) { 7 | a = n / 100; 8 | b = n / 10 % 10; 9 | c = n % 10; 10 | if (n == a * a * a + b * b * b + c * c * c) 11 | cout << "Yes" << endl; 12 | else 13 | cout << "No" << endl; 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0040.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } 6 | 7 | int lcm(int a, int b) { return a / gcd(a, b) * b; } 8 | 9 | int main() { 10 | int n, i, j; 11 | for (cin >> n; n-- && cin >> i >> j; 12 | cout << gcd(i, j) << " " << lcm(i, j) << endl) 13 | ; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0041.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main() { 8 | vector v(3); 9 | cin >> v[0] >> v[1] >> v[2]; 10 | sort(v.begin(), v.end()); 11 | cout << v[0] << " " << v[1] << " " << v[2] << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0056.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int i, j, k, m, n, s; 7 | for (cin >> s; s-- && cin >> n >> m;) { 8 | for (i = m, j = 0; i <= n; i++) 9 | for (k = i; !(k % m); j++) k = k / m; 10 | cout << j << endl; 11 | } 12 | return 0; 13 | } -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0259.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() { 7 | int n; 8 | string s; 9 | for (cin >> n; n-- && cin >> s; cout << s << endl) 10 | ; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/01语言入门/0260.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main(int cas, int n) { 7 | for (cin >> cas; cas-- && cin >> n; cout << n * (n + 1) * (n + 2) / 6 << endl) 8 | ; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/acm.nyist.net/input.txt: -------------------------------------------------------------------------------- 1 | 6 2 | 1 3 | 2 4 | 2 5 | 2 6 | 3 7 | 5 8 | -------------------------------------------------------------------------------- /OJ/acm.nyist.net/output.txt: -------------------------------------------------------------------------------- 1 | 2 1 2 | 2 1 3 | 0 5 4 | -------------------------------------------------------------------------------- /OJ/codeforces.com/110A - Nearly Lucky Number.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int count(LL n) { 7 | int tot = 0; 8 | while (n) { 9 | int d = n % 10; 10 | n /= 10; 11 | if (d == 4 or d == 7) 12 | ++tot; 13 | } 14 | return tot; 15 | } 16 | 17 | 18 | int main() { 19 | LL n; 20 | cin >> n; 21 | int m = count(n); 22 | cout << (m == 4 or m == 7 ? "YES" : "NO") << endl; 23 | return 0; 24 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/112A - Petya and Strings.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string a, b; 7 | cin >> a >> b; 8 | transform(a.begin(), a.end(), a.begin(), ::tolower); 9 | transform(b.begin(), b.end(), b.begin(), ::tolower); 10 | if (a > b)cout << 1 << endl; 11 | else if (a < b)cout << -1 << endl; 12 | else cout << 0 << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/116A - Tram.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int tot = 0, gmax = 0; 7 | int T; 8 | cin >> T; 9 | while (T--) { 10 | int in, out; 11 | cin >> in >> out; 12 | tot -= in; 13 | tot += out; 14 | gmax = max(gmax, tot); 15 | } 16 | cout << gmax << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/118A - String Task.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string s; 7 | cin >> s; 8 | transform(s.begin(), s.end(), s.begin(), ::tolower); 9 | string t, V("aeiouy"); 10 | for (auto c:s) { 11 | if (V.find(c) != string::npos) { 12 | continue; 13 | } 14 | t.push_back('.'); 15 | t.push_back(c); 16 | } 17 | cout << t << endl; 18 | return 0; 19 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/122A.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 2019-05-23. 3 | // 4 | 5 | #include 6 | using namespace std; 7 | int main(){ 8 | int n; 9 | cin >> n; 10 | int flag = 0; 11 | vectorv = {4, 7, 47, 74, 444, 447, 477, 744, 747, 774, 777}; 12 | for(int i = 0; i < v.size(); i++){ 13 | if(n % v[i] == 0){ 14 | flag = 1; 15 | break; 16 | } 17 | } 18 | cout << (flag ? "YES" : "NO") << endl; 19 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/133A - HQ9+.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | string s; 8 | cin >> s; 9 | string t; 10 | if (s.find('H') == string::npos and s.find('Q') == string::npos and s.find('9') == string::npos) 11 | cout << "NO" << endl; 12 | else 13 | cout << "YES" << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/136A - Presents.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | map G; 9 | for (int i = 1; i <= n; i++) { 10 | int t; 11 | cin >> t; 12 | G[t] = i; 13 | } 14 | for (int i = 1; i <= n; i++) { 15 | cout << G[i] << " "; 16 | } 17 | cout << endl; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /OJ/codeforces.com/148A - Insomnia cure.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int k, l, m, n, d; 8 | cin >> k >> l >> m >> n >> d; 9 | vector D(d + 1, 1); 10 | for (int i = 1; i <= d; i++)D[i / l * l] = D[i / k * k] = D[i / m * m] = D[i / n * n] = 0; 11 | cout << d - accumulate(D.begin() + 1, D.end(), 0) << endl; 12 | 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/158A - Next Round.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n, k; 7 | cin >> n >> k; 8 | vector a(n); 9 | for (auto &e:a)cin >> e; 10 | int score = max(a[k - 1], 1); 11 | cout << upper_bound(a.begin(), a.end(), score,greater()) - a.begin() << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/158A.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 2019-05-23. 3 | // 4 | 5 | #include 6 | using namespace std; 7 | int main(){ 8 | int n, k; 9 | cin >> n >> k; 10 | vectorv; 11 | for(int i = 0; i < n; i++){ 12 | int x; 13 | cin >> x; 14 | v.push_back(x); 15 | } 16 | auto p = upper_bound(v.begin(), v.end(), max(v[k-1], 1), greater()); 17 | cout << p - v.begin() << endl; 18 | return 0; 19 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/158B - Taxi.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int g; 7 | cin >> g; 8 | int taxi = 0; 9 | vector M(4, 0); 10 | while (g--) { 11 | int t; 12 | cin >> t; 13 | taxi += t / 4; 14 | M[t % 4]++; 15 | } 16 | taxi += M[3]; 17 | M[1] -= M[3]; 18 | taxi += (M[2] + 1) / 2; 19 | M[1] -= 2 * (M[2] % 2); 20 | if (M[1] > 0)taxi += (M[1] + 3) / 4; 21 | cout << taxi << endl; 22 | return 0; 23 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/160A - Twins.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | vector a(n); 9 | for (auto &e:a)cin >> e; 10 | sort(a.begin(), a.end(), greater()); 11 | partial_sum(a.begin(), a.end(), a.begin()); 12 | auto pos = lower_bound(a.begin(), a.end(), a.back() / 2 + 1); 13 | cout << pos - a.begin() + 1 << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/1A - Theatre Square.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n, m, a; 7 | cin >> n >> m >> a; 8 | cout << 1LL * ((n + a - 1) / a) *((m + a - 1) / a) << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/231A - Team.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int T; 7 | cin >> T; 8 | int tot = 0; 9 | while (T--) { 10 | int a, b, c; 11 | cin >> a >> b >> c; 12 | if (a + b + c >= 2)++tot; 13 | } 14 | cout << tot << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/236A - Boy or Girl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | string s; 8 | cin >> s; 9 | map M; 10 | for (auto c:s)M[tolower(c)]++; 11 | if (M.size() & 1)cout << "IGNORE HIM!" << endl; 12 | else cout << "CHAT WITH HER!" << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/236A.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 2019-05-24. 3 | // 4 | 5 | #include 6 | using namespace std; 7 | int main(){ 8 | string s; 9 | cin >> s; 10 | sort(s.begin(), s.end()); 11 | auto p = unique(s.begin(), s.end()); 12 | cout << ((p - s.begin()) % 2 ==0? "CHAT WITH HER!" : "IGNORE HIM!" )<< endl; 13 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/263A - Beautiful Matrix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int a[6][6]; 8 | int x, y; 9 | for (int i = 1; i <= 5; i++) 10 | for (int j = 1; j <= 5; j++) { 11 | int t; 12 | cin >> t; 13 | if (t == 1) { 14 | x = i; 15 | y = j; 16 | } 17 | } 18 | cout << abs(3 - x) + abs(3 - y) << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/266A - Stones on the Table.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int n; 8 | cin >> n; 9 | string s; 10 | cin >> s; 11 | stack S; 12 | int removed = 0; 13 | for (auto c:s) { 14 | if (S.empty() or S.top() != c) { 15 | S.push(c); 16 | } else { 17 | removed++; 18 | } 19 | } 20 | cout << removed << endl; 21 | return 0; 22 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/266A.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 2019-05-23. 3 | // 4 | 5 | #include 6 | using namespace std; 7 | int main(){ 8 | int n; 9 | cin >> n; 10 | string s; 11 | cin >> s; 12 | int count = 0; 13 | for(int i = 1; i < n; i++){ 14 | if(s[i] == s[i-1])count++; 15 | } 16 | cout << count << endl; 17 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/271A - Beautiful Year.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int y; 7 | cin >> y; 8 | for (int z = y + 1;; z++) { 9 | map d; 10 | for (int t = z; t; t /= 10)d[t % 10]++; 11 | if (d.size() == 4) { 12 | cout << z << endl; 13 | break; 14 | } 15 | } 16 | return 0; 17 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/2812A - WordCapitalization.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | string s; 8 | cin >> s; 9 | s[0] = toupper(s[0]); 10 | cout << s << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/282A - Bit++.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int x = 0, T; 7 | cin >> T; 8 | for (string s; T-- and cin >> s;) { 9 | if (s == "++X" or s == "X++")++x; 10 | else if (s == "--X" or s == "X--")--x; 11 | } 12 | cout << x << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/337A - Puzzles.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n, m; 7 | cin >> n >> m; 8 | vector a(m); 9 | for (auto &e:a)cin >> e; 10 | sort(a.begin(), a.end()); 11 | int ans = INT_MAX; 12 | for (int i = 0; i + n - 1 < m; i++) { 13 | ans = min(a[i + n - 1] - a[i], ans); 14 | } 15 | cout << ans << endl; 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /OJ/codeforces.com/339A - Helpful Maths.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string a, b; 7 | cin >> a >> b; 8 | transform(a.begin(), a.end(), a.begin(), ::tolower); 9 | transform(b.begin(), b.end(), b.begin(), ::tolower); 10 | if (a > b)cout << 1 << endl; 11 | else if (a < b)cout << -1 << endl; 12 | else cout << 0 << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/379A - New Year Candles .cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | inline int read_int() { 7 | int x; 8 | scanf("%d", &x); 9 | return x; 10 | } 11 | 12 | #define FOR(i, x, y) for (decay::type i = (x), _##i = (y); i < _##i; ++i) 13 | #define FORD(i, x, y) for (decay::type i = (x), _##i = (y); i > _##i; --i) 14 | 15 | int main() { 16 | int a, b; 17 | cin >> a >> b; 18 | cout << a + (a - 1) / (b - 1) << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/405A.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/OJ/codeforces.com/405A.cpp -------------------------------------------------------------------------------- /OJ/codeforces.com/41A - Translation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string s, t; 7 | cin >> s >> t; 8 | reverse(s.begin(), s.end()); 9 | cout << (s == t ? "YES" : "NO"); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /OJ/codeforces.com/451A - Game With Sticks.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main() { 7 | int n, m; 8 | cin >> n >> m; 9 | int tot = m * n; 10 | int k = 0; 11 | while (tot > 0) { 12 | tot -= m + n - 1; 13 | m--, n--; 14 | k++; 15 | } 16 | if (k & 1)cout << "Akshat" << endl; 17 | else cout << "Malvika" << endl; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /OJ/codeforces.com/455A_SimpleDP.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/OJ/codeforces.com/455A_SimpleDP.cpp -------------------------------------------------------------------------------- /OJ/codeforces.com/467A - George and Accommodation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int n; 8 | cin >> n; 9 | int tot = 0; 10 | while (n--) { 11 | int p, q; 12 | cin >> p >> q; 13 | if (q - p >= 2)++tot; 14 | } 15 | cout << tot << endl; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/479A - Expression.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b, c; 7 | cin >> a >> b >> c; 8 | int m = 0; 9 | m = max(m, a + b + c); 10 | m = max(m, a + b * c); 11 | m = max(m, (a + b) * c); 12 | m = max(m, a * (b + c)); 13 | m = max(m, (a * b) + c); 14 | m = max(m, a * b * c); 15 | cout << m << endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /OJ/codeforces.com/496A - Minimum Difficulty_线性算法.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define FOR(i, a, b) for(int i=(a);i<=(b);i++) 9 | #define LL long long 10 | #define writeln(x) printf("%d\n",x) 11 | #define write(x) printf("%d",x) 12 | #define PI acos(-1.0) 13 | 14 | int main() { 15 | double r, h; 16 | scanf("%lf%lf", &r, &h); 17 | printf("Area=%.3f\n", 2 * PI * r * r + 2 * PI * r * h); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/4A - Watermelon.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int w; 7 | cin >> w; 8 | cout << (w<=2 or (w & 1) ? "NO" : "YES") << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/4C - Registration System.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/OJ/codeforces.com/4C - Registration System.cpp -------------------------------------------------------------------------------- /OJ/codeforces.com/50A - Domino piling.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int m, n; 7 | cin >> m >> n; 8 | cout << (1LL * m * n) / 2 << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/546A - Soldier and Bananas.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int k, n, w; 8 | cin >> k >> n >> w; 9 | int m = k * w * (w + 1) / 2; 10 | cout << max(0, m - n) << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/550A - Two Substrings.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/OJ/codeforces.com/550A - Two Substrings.cpp -------------------------------------------------------------------------------- /OJ/codeforces.com/580A - Kefa and First Steps.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | vector S; 9 | int ans = 0; 10 | while (n--) { 11 | int x; 12 | cin >> x; 13 | if (not S.empty() and S.back() > x) 14 | S.clear(); 15 | S.push_back(x); 16 | ans = max(ans, (int) S.size()); 17 | } 18 | cout << ans << endl; 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /OJ/codeforces.com/58A - Chat room.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | string s("olleh"), t; 8 | cin >> t; 9 | stack S; 10 | for (auto c:s)S.push(c); 11 | for (auto c:t) { 12 | if (not S.empty() and c == S.top())S.pop(); 13 | } 14 | if (S.empty())cout << "YES" << endl; 15 | else cout << "NO" << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/69A - Young Physicist.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | int X = 0, Y = 0, Z = 0; 9 | while (n--) { 10 | int x, y, z; 11 | cin >> x >> y >> z; 12 | X += x, Y += y, Z += z; 13 | } 14 | if (X == 0 and Y == 0 and Z == 0) 15 | cout << "YES" << endl; 16 | else 17 | cout << "NO" << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /OJ/codeforces.com/71A - Way Too Long Words.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | ifstream cin("input.txt"); 7 | int T; 8 | cin >> T; 9 | while (T--) { 10 | string s; 11 | cin >> s; 12 | if (s.size() <= 10) { cout << s << endl; } 13 | else { 14 | cout << s[0] << s.substr(1, s.size() - 2).size() << s.back() << endl; 15 | } 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/82A - Double Cola_AC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main() { 7 | vector P = {"Sheldon", "Leonard", "Penny", "Rajesh", "Howard"}; 8 | LL n; 9 | cin >> n; 10 | LL x = 5; 11 | LL y = 1; 12 | while (n > x) { 13 | n -= x; 14 | x *= 2; 15 | y *= 2; 16 | } 17 | cout << P[--n / y] << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /OJ/codeforces.com/82A - Double Cola_Math.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main() { 7 | vector P = {"Sheldon", "Leonard", "Penny", "Rajesh", "Howard"}; 8 | LL n; 9 | cin >> n; 10 | n += 4; 11 | int k = log(n / 5) / log(2); 12 | n %= (5LL << k); 13 | cout << P[(n / (1LL << k))] << endl; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /OJ/codeforces.com/96A - Football.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string s; 7 | cin >> s; 8 | if (s.find("1111111") == string::npos and s.find("0000000") == string::npos) { 9 | cout << "NO" << endl; 10 | } else { 11 | cout << "YES" << endl; 12 | } 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/codeforces.com/B/CCPCGD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | 6 | int main() { 7 | int T; 8 | cin >> T; 9 | while (T--) { 10 | int w; 11 | string s; 12 | cin >> w >> s; 13 | auto p = s.find('8'); 14 | if (p == string::npos or s.size() - p <11) { 15 | cout << "NO" << endl; 16 | } else { 17 | cout << "YES" << endl; 18 | } 19 | } 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /OJ/codeforces.com/CodeForces-ProblemSet试题分类表.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/OJ/codeforces.com/CodeForces-ProblemSet试题分类表.xlsx -------------------------------------------------------------------------------- /OJ/codeforces.com/~$CodeForces-ProblemSet试题分类表.xlsx: -------------------------------------------------------------------------------- 1 | ZHAO Jing ZHAO Jing -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Algorithms and Data Structures I/ALDS1_1_B_GCD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } 4 | int main(int argc, char const *argv[]) { 5 | int a, b; 6 | cin >> a >> b; 7 | cout << gcd(a, b) << endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Algorithms and Data Structures I/ALDS1_1_D_MaximumProfit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | int n; 7 | cin >> n; 8 | vector R(n); 9 | for (auto &i : R) cin >> i; 10 | int maxv = -1; 11 | for (int j = 1; j < n; j++) 12 | for (int i = 0; i < j; i++) maxv = max(maxv, R[j] - R[i]); 13 | cout << maxv << endl; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Algorithms and Data Structures I/ALDS1_1_D_MaximumProfit2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char const *argv[]) { 5 | int n; 6 | cin >> n; 7 | vector R(n); 8 | for (auto &i : R) cin >> i; 9 | int maxv = INT_MIN; 10 | int minv = R[0]; 11 | for (int i = 1; i < n; i++) { 12 | maxv = max(maxv, R[i] - minv); 13 | minv = min(minv, R[i]); 14 | } 15 | 16 | cout << maxv << endl; 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Algorithms and Data Structures I/ALDS1_1_D_MaximumProfit3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char const *argv[]) { 5 | int n; 6 | cin >> n; 7 | int t; 8 | cin >> t; 9 | int maxv = INT_MIN; 10 | int minv = t; 11 | for (int i = 1; i < n; i++) { 12 | cin >> t; 13 | maxv = max(maxv, t - minv); 14 | minv = min(minv, t); 15 | } 16 | 17 | cout << maxv << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Algorithms and Data Structures I/ALDS1_6_A_CountingSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[20000000]; 4 | int main(int argc, char const *argv[]) { 5 | ios::sync_with_stdio(false); 6 | int n; 7 | cin >> n; 8 | for (int i = 0; i < n; i++) 9 | cin >> a[i]; 10 | sort(a, a + n); 11 | cout << a[0]; 12 | for (int i = 1; i < n; i++) 13 | cout << " " << a[i]; 14 | cout << endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Algorithms and Data Structures I/Ex0202Top3B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char const *argv[]) { 6 | vector S(10); 7 | for (auto &i : S) { 8 | cin >> i; 9 | } 10 | sort(S.begin(), S.end()); 11 | copy(S.rbegin(), S.rbegin() + 3, ostream_iterator(cout, " ")); 12 | cout << endl; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Algorithms and Data Structures I/in.txt: -------------------------------------------------------------------------------- 1 | 6 2 | 5 2 4 6 1 3 -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_10_A_Distance.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | double x1, y1, x2, y2; 7 | cin >> x1 >> y1 >> x2 >> y2; 8 | cout << fixed << setprecision(8) << hypot(x1 - x2, y1 - y2) << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_10_C_StandardDeviation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int n; cin >> n and n != 0;) { 7 | vector S(n); 8 | for (auto &e:S)cin >> e; 9 | double m = accumulate(S.begin(), S.end(), 0.0); 10 | double sd = 0; 11 | for (auto e:S) sd += (n * e - m) * (n * e - m); 12 | cout << fixed << setprecision(8) << sqrt(sd / n) / n << endl; 13 | } 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_1_A_HelloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | cout << "Hello world" << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_1_B_XCubic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a; 7 | cin >> a; 8 | cout << a * a * a << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_1_C_Rectangle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b; 7 | cin >> a >> b; 8 | cout << a * b << " "; 9 | cout << 2 * (a + b) << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_1_D_Watch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int S; 7 | cin >> S; 8 | int h = S / 3600; 9 | S %= 3600; 10 | int m = S / 60; 11 | int s = S % 60; 12 | cout << h << ":" << m << ":" << s << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_2_A_SmallLargEqual.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b; 7 | cin >> a >> b; 8 | if (a > b) 9 | cout << "a > b" << endl; 10 | else if (a < b) 11 | cout << "a < b" << endl; 12 | else 13 | cout << "a == b" << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_2_B_Range.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b, c; 7 | cin >> a >> b >> c; 8 | if (a < b && b < c) 9 | cout << "Yes" << endl; 10 | else 11 | cout << "No" << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_2_C_SortTHreeNumbers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a[3]; 7 | cin >> a[0] >> a[1] >> a[2]; 8 | sort(a, a + 3); 9 | cout << a[0] << " " << a[1] << " " << a[2] << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_2_D_CircleInARectangle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int W, H, x, y, r; 7 | cin >> W >> H >> x >> y >> r; 8 | int top = y + r; 9 | int bottom = y - r; 10 | int left = x - r; 11 | int right = x + r; 12 | if (top <= H && bottom >= 0 && left >= 0 && right <= W) 13 | cout << "Yes" << endl; 14 | else 15 | cout << "No" << endl; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_3_A_PrintManyHelloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int i = 0; i < 1000; ++i) { 7 | cout << "Hello World" << endl; 8 | } 9 | return 0; 10 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_3_B_PrintCase.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int no = 1, x; cin >> x;) { 7 | if (x == 0) break; 8 | cout << "Case " << no++ << ": " << x << endl; 9 | } 10 | return 0; 11 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_3_C_SwapTwoNumbers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (int a, b; cin >> a >> b;) { 7 | if (a == 0 && b == 0) break; 8 | if (a > b) swap(a, b); 9 | cout << a << " " << b << endl; 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_3_D_HowManyDivisors.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b, c; 7 | cin >> a >> b >> c; 8 | int tot = 0; 9 | for (int x = a; x <= b; x++) 10 | if (c % x == 0) 11 | ++tot; 12 | cout << tot << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_4_A_Computation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int a, b; 7 | cin >> a >> b; 8 | int d = a / b; 9 | int r = a % b; 10 | double f = 1.0 * a / b; 11 | cout << d << " " << r << " " << fixed << setprecision(5) << f << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_4_B_Circle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | double r; 7 | cin >> r; 8 | const double pi = acos(-1); 9 | double area = pi * r * r; 10 | double perimeter = 2 * pi * r; 11 | cout << fixed << setprecision(5) << area << " " << perimeter << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_4_D_MinMaxSum.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | typedef long long LL; 5 | 6 | int main() { 7 | int n; 8 | cin >> n; 9 | vector v(n); 10 | for (int i = 0; i < n; i++) cin >> v[i]; 11 | LL Min = *min_element(v.begin(), v.end()); 12 | LL Max = *max_element(v.begin(), v.end()); 13 | LL Sum = accumulate(v.begin(), v.end(), 0); 14 | cout << Min << " " << Max << " " << Sum << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_6_A_ReverseNumbers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | int n; 7 | cin >> n; 8 | vector v(n); 9 | for (auto &e:v)cin >> e; 10 | for (int i = n - 1; i >= 0; i--) { 11 | cout << v[i]; 12 | if (i > 0) cout << " "; 13 | } 14 | cout << endl; 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_8_A_TogglingCases.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void op(char &c) { 6 | if (isupper(c))_tolower(c); 7 | else _toupper(c); 8 | } 9 | 10 | int main() { 11 | string line; 12 | getline(cin, line); 13 | transform(line.begin(), line.end(), op); 14 | cout << line << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_8_B_DigitsSum.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | for (string s; cin >> s and s != "0"; cout << accumalte(s.begin(), s.end(), 0) - s.size() * '0' << endl); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_8_C_CountingCharacters.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | map mp; 7 | for (string s; getline(cin, s);) 8 | for (auto c:s) 9 | ++mp[tolower(c)]; 10 | for (char c = 'a'; c <= 'z'; c++) 11 | cout << c << " : " << mp[c] << endl; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_8_D_Ring.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string s, p; 7 | cin >> s >> p; 8 | s += s; 9 | if (s.find(p) != string::npos) 10 | cout << "Yes" << endl; 11 | else 12 | cout << "No" << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/ITP1_9_A_FindingAWord.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | string key; 7 | cin >> key; 8 | transform(key.begin(), key.end(), key.begin(), ::tolower); 9 | int cnt = 0; 10 | for (string s; cin >> s and s != "END_OF_TEXT";) { 11 | transform(s.begin(), s.end(), s.begin(), ::tolower); 12 | if (s == key) ++cnt; 13 | } 14 | cout << cnt << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming I/in.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 70 80 100 90 20 3 | 3 4 | 80 80 80 5 | 1 6 | 100 7 | 1 8 | 50 9 | 1 10 | 0 11 | 10 12 | 0 0 0 0 0 0 0 0 0 0 13 | 10 14 | 1 34 44 63 30 1 9 53 57 57 15 | 10 16 | 20 12 52 44 6 9 94 31 67 70 17 | 0 18 | -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_10_A_BitOperationI.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() { 6 | unsigned int x; 7 | cin >> x; 8 | bitset<32> b(x); 9 | cout << b << endl; 10 | b.flip(); 11 | cout << b << endl; 12 | b.flip(); 13 | b <<= 1; 14 | cout << b << endl; 15 | b >>= 2; 16 | cout << b << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_10_B_BitOperationII.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | unsigned a, b; 5 | cin >> a >> b; 6 | bitset<32> A(a), B(b); 7 | cout << A << endl; 8 | cout << B << endl; 9 | cout << (A ^ B) << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_1_A_Vector.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | 5 | vector a; 6 | int q; 7 | cin >> q; 8 | while (q--) { 9 | int op; 10 | cin >> op; 11 | if (op == 0) { 12 | int x; 13 | cin >> x; 14 | a.push_back(x); 15 | } else if (op == 1) { 16 | int p; 17 | cin >> p; 18 | cout << a[p] << endl; 19 | } else { 20 | a.pop_back(); 21 | } 22 | } 23 | 24 | return 0; 25 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_3_A_MinMax.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int a, b, c; 5 | cin >> a >> b >> c; 6 | cout << min(a, min(b, c)) << " " << max(a, max(b, c)) << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_3_C_Count.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector A(n); 7 | for (int i = 0; i < n; i++) cin >> A[i]; 8 | int q; 9 | cin >> q; 10 | while (q--) { 11 | int b, e, k; 12 | cin >> b >> e >> k; 13 | cout << count(A.begin() + b, A.begin() + e, k) << endl; 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_3_D_LogicalComparison.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (int i = 0; i < n; i++) cin >> a[i]; 8 | int m; 9 | cin >> m; 10 | vector b(m); 11 | for (int i = 0; i < m; i++) cin >> b[i]; 12 | cout << (b > a) << endl; 13 | 14 | return 0; 15 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_4_A_Reverse.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (auto &p : a) cin >> p; 8 | int q; 9 | cin >> q; 10 | while (q--) { 11 | int b, e; 12 | cin >> b >> e; 13 | reverse(a.begin() + b, a.begin() + e); 14 | } 15 | for (int i = 0; i < n; i++) { 16 | if (i) cout << " "; 17 | cout << a[i]; 18 | } 19 | cout << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_4_C_Swap.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (auto &p : a) cin >> p; 8 | int q; 9 | cin >> q; 10 | while (q--) { 11 | int b, e, t; 12 | cin >> b >> e >> t; 13 | for (int k = 0; k < e - b; k++) swap(a[b + k], a[t + k]); 14 | } 15 | for (int i = 0; i < n; i++) { 16 | if (i) cout << " "; 17 | cout << a[i]; 18 | } 19 | cout << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_4_D_Unique.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (auto &p : a) cin >> p; 8 | auto p = unique(a.begin(), a.end()); 9 | for (int i = 0; i < p - a.begin(); i++) { 10 | if (i) cout << " "; 11 | cout << a[i]; 12 | } 13 | cout << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_5_A_SortingPairs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector> v(n); 7 | for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second; 8 | sort(v.begin(), v.end()); 9 | for (auto p : v) cout << p.first << " " << p.second << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_5_D_EnumPermulation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | void print(vector v) { 4 | for (size_t i = 0; i < v.size(); i++) { 5 | if (i) cout << " "; 6 | cout << v[i]; 7 | } 8 | cout << endl; 9 | } 10 | int main() { 11 | int n; 12 | cin >> n; 13 | vector a; 14 | for (int i = 1; i <= n; i++) a.push_back(i); 15 | do { 16 | print(a); 17 | } while (next_permutation(a.begin(), a.end())); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_6_A_BinarySearch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (auto &p : a) cin >> p; 8 | int q; 9 | cin >> q; 10 | while (q--) { 11 | int k; 12 | cin >> k; 13 | cout << binary_search(a.begin(), a.end(), k) << endl; 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_6_B_Includes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (auto& p : a) cin >> p; 8 | int m; 9 | cin >> m; 10 | vector b(m); 11 | for (auto& p : b) cin >> p; 12 | cout << includes(a.begin(), a.end(), b.begin(), b.end()) << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_6_C_LowerBound.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (auto& p : a) cin >> p; 8 | int q; 9 | cin >> q; 10 | while (q--) { 11 | int k; 12 | cin >> k; 13 | cout << lower_bound(a.begin(), a.end(), k) - a.begin() << endl; 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_6_D_EqualRange.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | vector a(n); 7 | for (auto& p : a) cin >> p; 8 | int q; 9 | cin >> q; 10 | while (q--) { 11 | int k; 12 | cin >> k; 13 | int left = lower_bound(a.begin(), a.end(), k) - a.begin(); 14 | int right = upper_bound(a.begin(), a.end(), k) - a.begin(); 15 | cout << left << " " << right << endl; 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_7_A_Search.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | set S; 5 | int q; 6 | cin >> q; 7 | while (q--) { 8 | int op, x; 9 | cin >> op >> x; 10 | if (op == 0) { 11 | S.insert(x); 12 | cout << S.size() << endl; 13 | } else if (op == 1) { 14 | cout << (S.find(x) != S.end()) << endl; 15 | } 16 | } 17 | 18 | return 0; 19 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_7_B_Delete.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | set S; 5 | int q; 6 | cin >> q; 7 | while (q--) { 8 | int op, x; 9 | cin >> op >> x; 10 | if (op == 0) { 11 | S.insert(x); 12 | cout << S.size() << endl; 13 | } else if (op == 1) { 14 | cout << (S.find(x) != S.end()) << endl; 15 | } else if (op == 2) { 16 | S.erase(x); 17 | } 18 | } 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_9_A_SetUnion.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | set A; 7 | while (n--) { 8 | int t; 9 | cin >> t; 10 | A.insert(t); 11 | } 12 | int m; 13 | cin >> m; 14 | while (m--) { 15 | int t; 16 | cin >> t; 17 | A.insert(t); 18 | } 19 | for (auto x : A) 20 | cout << x << endl; 21 | return 0; 22 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/ITP2_9_C_SetDifference.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | set A; 7 | while (n--) { 8 | int t; 9 | cin >> t; 10 | A.insert(t); 11 | } 12 | int m; 13 | cin >> m; 14 | set B; 15 | while (m--) { 16 | int t; 17 | cin >> t; 18 | if (A.find(t) != A.end()) { 19 | B.insert(t); 20 | } 21 | } 22 | for (auto x : B) 23 | cout << x << endl; 24 | return 0; 25 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Introduction to Programming II/in.txt: -------------------------------------------------------------------------------- 1 | 24 2 | 0 pink 300 3 | 0 blue 250 4 | 0 red 100 5 | 1 blue 6 | 2 red 7 | 0 black 380 8 | 0 yellow 400 9 | 0 green 80 10 | 1 green 11 | 2 pink 12 | 1 red 13 | 1 blue 14 | 1 pink 15 | 1 black 16 | 0 pink 1000 17 | 0 black 1000 18 | 1 pink 19 | 1 black 20 | 1 white 21 | 2 black 22 | 1 black 23 | 3 a z 24 | 3 green pink 25 | 3 green pin -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Number Theory/NTL_1_A_PrimeFactorize.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | cout << n << ":"; 7 | for (int i = 2; n > 1; i++) { 8 | if (i * i > n) break; 9 | while (n % i == 0) { 10 | cout << " " << i; 11 | n /= i; 12 | } 13 | } 14 | if (n > 1) cout << " " << n; 15 | cout << endl; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Number Theory/NTL_1_B_Power.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long LL; 4 | const int MOD = 1e9 + 7; 5 | LL mpower(LL a, int n) { 6 | long long ans = 1; 7 | while (n > 0) { 8 | if (n & 1) { 9 | ans *= a; 10 | ans %= MOD; 11 | } 12 | a *= a % MOD; 13 | a %= MOD; 14 | n >>= 1; 15 | } 16 | return ans % MOD; 17 | } 18 | int main() { 19 | int n, m; 20 | cin >> m >> n; 21 | cout << mpower(m, n) << endl; 22 | 23 | return 0; 24 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Number Theory/NTL_1_C_LCM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long LL; 4 | LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; } 5 | LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } 6 | int main() { 7 | int n; 8 | cin >> n; 9 | int ans = 1; 10 | while (n--) { 11 | int t; 12 | cin >> t; 13 | ans = lcm(ans, t); 14 | } 15 | cout << ans << endl; 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Number Theory/NTL_1_D_EulerFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long LL; 4 | int phi(int n) { 5 | int ret = n; 6 | for (int i = 2; i * i <= n; i++) 7 | if (n % i == 0) { 8 | ret = ret / i * (i - 1); //先进行除法防止溢出(ret=ret*(1-1/p(i))) 9 | while (n % i == 0) n /= i; 10 | } 11 | if (n > 1) ret = ret / n * (n - 1); 12 | return ret; 13 | } 14 | int main() { 15 | int n; 16 | cin >> n; 17 | cout << phi(n) << endl; 18 | 19 | return 0; 20 | } -------------------------------------------------------------------------------- /OJ/judge.u-aizu.ac.jp/Number Theory/NTL_2_A_AdditionOfBigIntegers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | 6 | return 0; 7 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cplusplus 2 | 3 | ACM@C++ -------------------------------------------------------------------------------- /a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/a -------------------------------------------------------------------------------- /cmake-build-debug/cplusplu: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/cmake-build-debug/cplusplu -------------------------------------------------------------------------------- /cmake-build-debug/cplusplus: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/cmake-build-debug/cplusplus -------------------------------------------------------------------------------- /cmake-build-debug/cplusplus2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/cmake-build-debug/cplusplus2 -------------------------------------------------------------------------------- /cmake-build-debug/input.txt: -------------------------------------------------------------------------------- 1 | a 2 | b -------------------------------------------------------------------------------- /cmake-build-debug/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/cmake-build-debug/out.txt -------------------------------------------------------------------------------- /input.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 29 3 | 5 4 | elo nov 5 | tam -------------------------------------------------------------------------------- /makeData.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by jal on 2019-06-03. 3 | // 4 | 5 | #include 6 | using namespace std; 7 | int main(){ 8 | int t = 1; 9 | for(int i = 1; i <= 10; i++){ 10 | ostringstream oss; 11 | oss << i; 12 | istringstream iss(oss.str()); 13 | string s; 14 | iss >> s; 15 | s = "data" + s + ".in"; 16 | ofstream cout(s); 17 | cout << t << endl; 18 | t *= 10; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /out/build/x64-Debug/.cmake/api/v1/query/client-MicrosoftVS/query.json: -------------------------------------------------------------------------------- 1 | {"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2}]} -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/3.14.19060802-MSVC_2/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/out/build/x64-Debug/CMakeFiles/3.14.19060802-MSVC_2/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/3.14.19060802-MSVC_2/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/out/build/x64-Debug/CMakeFiles/3.14.19060802-MSVC_2/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/3.14.19060802-MSVC_2/CMakeRCCompiler.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_RC_COMPILER "C:/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64/rc.exe") 2 | set(CMAKE_RC_COMPILER_ARG1 "") 3 | set(CMAKE_RC_COMPILER_LOADED 1) 4 | set(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc;RC) 5 | set(CMAKE_RC_OUTPUT_EXTENSION .res) 6 | set(CMAKE_RC_COMPILER_ENV_VAR "RC") 7 | -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/3.14.19060802-MSVC_2/CMakeSystem.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_HOST_SYSTEM "Windows-10.0.17763") 2 | set(CMAKE_HOST_SYSTEM_NAME "Windows") 3 | set(CMAKE_HOST_SYSTEM_VERSION "10.0.17763") 4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64") 5 | 6 | 7 | 8 | set(CMAKE_SYSTEM "Windows-10.0.17763") 9 | set(CMAKE_SYSTEM_NAME "Windows") 10 | set(CMAKE_SYSTEM_VERSION "10.0.17763") 11 | set(CMAKE_SYSTEM_PROCESSOR "AMD64") 12 | 13 | set(CMAKE_CROSSCOMPILING "FALSE") 14 | 15 | set(CMAKE_SYSTEM_LOADED 1) 16 | -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/CMakeOutput.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/out/build/x64-Debug/CMakeFiles/CMakeOutput.log -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/ShowIncludes/foo.h: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/ShowIncludes/main.c: -------------------------------------------------------------------------------- 1 | #include "foo.h" 2 | int main(){} 3 | -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/TargetDirectories.txt: -------------------------------------------------------------------------------- 1 | C:/Users/webturing/source/repos/cplusplus/out/build/x64-Debug/CMakeFiles/edit_cache.dir 2 | C:/Users/webturing/source/repos/cplusplus/out/build/x64-Debug/CMakeFiles/cplusplus2.dir 3 | C:/Users/webturing/source/repos/cplusplus/out/build/x64-Debug/CMakeFiles/rebuild_cache.dir 4 | -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/out/build/x64-Debug/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /out/build/x64-Debug/CMakeFiles/feature_tests.c: -------------------------------------------------------------------------------- 1 | 2 | const char features[] = {"\n" 3 | "C_FEATURE:" 4 | #if _MSC_VER >= 1600 5 | "1" 6 | #else 7 | "0" 8 | #endif 9 | "c_function_prototypes\n" 10 | "C_FEATURE:" 11 | #if _MSC_VER >= 1600 12 | "1" 13 | #else 14 | "0" 15 | #endif 16 | "c_variadic_macros\n" 17 | 18 | }; 19 | 20 | int main(int argc, char** argv) { (void)argv; return features[argc]; } 21 | -------------------------------------------------------------------------------- /out/build/x64-Debug/Testing/Temporary/LastTest.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/out/build/x64-Debug/Testing/Temporary/LastTest.log -------------------------------------------------------------------------------- /out/build/x64-Debug/VSInheritEnvironments.txt: -------------------------------------------------------------------------------- 1 | msvc_x64_x64 -------------------------------------------------------------------------------- /out/build/x64-Debug/rules.ninja: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/out/build/x64-Debug/rules.ninja -------------------------------------------------------------------------------- /测试文档.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webturing/cplusplus/6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f/测试文档.txt --------------------------------------------------------------------------------