├── .gitignore ├── 19OI └── 「2」射线.cpp ├── BZOJ ├── 1000 A+B Problem.cpp ├── 1176 [Balkan2007]Mokia.cpp ├── 1260 工程规划.cpp ├── 1269 [AHOI2006]文本编辑器editor.cpp ├── 1331 魔板.cpp ├── 1712 [NOI2016]区间.cpp ├── 1879 [USACO06NOV]玉米田Corn Fields.cpp ├── 1901 Zju2112 Dynamic Rankings.cpp ├── 2194 快速傅立叶之二.cpp ├── 2456 mode.cpp ├── 2480 Spoj3105 Mod.cpp ├── 2683 简单题.cpp ├── 2704 [NOI2001]炮兵阵地.cpp ├── 2705 [SDOI2012]Longge的问题.cpp ├── 2962 序列操作.cpp ├── 3132 上帝造题的七分钟.cpp ├── 3155 Preprefix sum.cpp ├── 3211 花神游历各国.cpp ├── 3212 Pku3468 A Simple Problem with Integers.cpp ├── 3236 [Ahoi2013]作业.cpp ├── 3239 Discrete Logging.cpp ├── 3289 Mato的文件管理.cpp ├── 3295 [Cqoi2011]动态逆序对.cpp ├── 3306 树.cpp ├── 3307 雨天的尾巴.cpp ├── 3508 开灯.cpp ├── 3538 [Usaco2014 Open]Dueling GPS.cpp ├── 3545 [ONTAK2010]Peaks.cpp ├── 3551 [ONTAK2010]Peaks加强版.cpp ├── 3674 可持久化并查集加强版.cpp ├── 3680 吊打XXX.cpp ├── 3740 [HAOI2014]贴海报.cpp ├── 3944 Sum.cpp ├── 4004 [JLOI2015]装备购买.cpp ├── 4318 OSU!.cpp ├── 4538 [Hnoi2016]网络.cpp ├── 4551 最长异或路径.cpp ├── 4712 洪水.cpp ├── 4712 洪水 │ ├── 1.cpp │ ├── 2.cpp │ └── 3.cpp ├── 5017 [Snoi2017]炸弹.cpp └── 5314 [Jsoi2018]潜入行动.cpp ├── CodeForces Gym ├── 101981A.cpp ├── 101981G.cpp └── 101981K.cpp ├── CodeForces ├── Codeforces #1082 │ ├── a.cpp │ ├── b.cpp │ ├── c.cpp │ ├── d.cpp │ ├── e.cpp │ ├── f.cpp │ └── g.cpp ├── Codeforces Round #486 (Div. 3) │ ├── A.cpp │ ├── B.cpp │ ├── C.cpp │ ├── D.cpp │ ├── E.cpp │ ├── F.cpp │ └── test.cpp ├── Codeforces Round #509 (Div. 2) │ ├── A.cpp │ ├── B.cpp │ ├── C.cpp │ ├── D.cpp │ ├── E.cpp │ └── F.cpp ├── Codeforces Round #513 (Div. 1 + Div. 2) │ ├── A.cpp │ ├── B.cpp │ ├── C.cpp │ ├── D.cpp │ ├── E.cpp │ ├── F.cpp │ ├── G.cpp │ └── H.cpp ├── Codeforces Round #514 (Div. 2) │ ├── A.cpp │ ├── B.cpp │ ├── C.cpp │ ├── D.cpp │ └── E.cpp ├── Codeforces Round #516 (Div. 2) │ ├── a.cpp │ ├── b.cpp │ ├── c.cpp │ ├── d.cpp │ ├── e.cpp │ └── f.cpp ├── Codeforces Round #517 (Div. 2) │ ├── a.cpp │ ├── b.cpp │ ├── c.cpp │ ├── d.cpp │ ├── e.cpp │ └── f.cpp ├── Codeforces Round #524 (Div. 2) │ ├── a.cpp │ ├── b.cpp │ ├── c.cpp │ ├── d.cpp │ ├── d_2.cpp │ ├── e.cpp │ └── f.cpp └── README.md ├── CodeVS ├── P1201.cpp ├── P1202.cpp ├── P1203.cpp ├── P1204.cpp ├── P1206.cpp └── P2235.cpp ├── Doing └── 3390 【模板】矩阵快速幂(#2).cpp ├── FLOJ ├── contest447 │ ├── 1.cpp │ ├── 2.cpp │ ├── 3.cpp │ └── 3_1.cpp ├── contest449 │ ├── 1.cpp │ ├── 2.cpp │ ├── 2_data.cpp │ ├── 3.cpp │ ├── rebuild.sh │ └── tmp │ │ ├── 1.cpp │ │ ├── 2.cpp │ │ └── 3.cpp └── contest457 │ ├── 1.cpp │ ├── 1_comp.cpp │ ├── 2.cpp │ ├── 2_comp.cpp │ ├── 3.cpp │ ├── rebuild.sh │ └── tmp │ ├── 1.cpp │ ├── 2.cpp │ └── 3.cpp ├── LJOJ ├── 1004 暗夜精灵.cpp ├── 1244 埃及分数(0).cpp ├── 1244 埃及分数(1).cpp ├── 1244 埃及分数(2).cpp ├── 1244 埃及分数.cpp ├── 1452 Beauty Contest.cpp ├── 1643 [HNOI2006]鬼谷子的钱袋.cpp ├── 2157 [SDOI2009] 学校食堂.cpp ├── 2638 黑白染色.cpp ├── 3745 车站分级.cpp ├── 3849 逆光.cpp ├── 3851 渴.cpp ├── 3852 三角形计数.cpp ├── 3853 ZCC loves Isaac.cpp ├── 3855 集合(0).cpp ├── 3855 集合.cpp ├── 3856 Nim游戏.cpp ├── 3858 心灵终结.cpp ├── 3860 Babystep.cpp ├── 3861 压位.cpp ├── 3862 公共子序列.cpp ├── 3863 youginzi.cpp ├── 3879 回路.cpp ├── 4228 降雷皇(0).cpp ├── 4228 降雷皇(2).cpp ├── 4228 降雷皇.cpp ├── 4450 abcd.cpp ├── 4451 好数.cpp ├── 4550 收集邮票.cpp ├── 4622 图.cpp ├── 4654 列车调度.cpp ├── 4655 保留道路.cpp ├── 4657 区间.cpp ├── 4676 或.cpp ├── 4956 挥金如土.cpp ├── 4957 量子谜题.cpp ├── 4958 第K小数.cpp ├── 4959 video.cpp ├── 4960 chance.cpp ├── 4961 plutotree.cpp ├── 4962 字母交换.cpp ├── 4963 混合表达式.cpp ├── 4964 特教的理性愉悦.cpp ├── 4965 马赛克.cpp ├── 4966 陪审团.cpp ├── 4967 为了爱情.cpp ├── 4972 峡谷.cpp ├── 4973 完美匹配.cpp ├── 4975 保护数列.cpp ├── 4976 树上行走.cpp ├── 4980 选举.cpp ├── 4986 城堡.cpp ├── 4986 最后一枪.cpp ├── 4988 随机数.cpp ├── 4990 因数.cpp ├── 4991 灯泡.cpp ├── 4992 切蛋糕.cpp ├── 4993 黑与白.cpp ├── 4995 beautiful.cpp ├── 4996 xor.cpp ├── 4997 Permutation.cpp ├── 5000 safe.cpp ├── 5001 shoot.cpp ├── 5005 字符串匹配.cpp ├── 5006 积木大赛.cpp ├── 5007 直径.cpp ├── 5008 T1.cpp ├── 5009 T2.cpp ├── 5010 T3.cpp ├── 5012 数学考试.cpp ├── 5013 英语考试.cpp ├── 5014 语文考试.cpp ├── 5025 香港记者.cpp ├── 5026 膜法师.cpp ├── 5027 钦点.cpp ├── 5029 收银员.cpp ├── 5030 选球游戏.cpp ├── 5034 两只怪物心心相印.cpp ├── 5036 water.cpp ├── 5038 蛋糕.cpp ├── 5039 志愿者.cpp ├── 5040 噪音.cpp ├── 5043 big.cpp ├── 5047 昆特牌.cpp ├── 5048 电梯.cpp ├── 5049 玩.cpp ├── 5052 雪人.cpp ├── 5054 卡片.cpp ├── 5055 车站.cpp ├── 5056 异或.cpp ├── 5056 物理课.cpp ├── 5057 取石子.cpp ├── 5057 数学课.cpp ├── 5058 优化.cpp ├── 5058 地理课.cpp ├── 5059 毛一琛.cpp ├── 5061 毛三琛.cpp ├── 5062 梦境.cpp ├── 5063 玩具.cpp ├── 5064 飘雪圣城.cpp ├── 5065 基础分治练习题.cpp ├── 5067 小水题.cpp ├── 5068 Lucky Transformation.cpp ├── 5069 Snake vs Block.cpp ├── 5070 Ping.cpp ├── 5071 养花.cpp ├── 5072 折射.cpp ├── 5073 画作.cpp ├── 5074 集合问题.cpp ├── 5075 序列.cpp ├── 5076 拉密.cpp ├── 5077 GCD.cpp ├── 5078 最短路.cpp ├── 5079 数列.cpp ├── 5080 树.cpp ├── 5081 环.cpp ├── 5082 礼物.cpp ├── 5084 蔬菜.cpp ├── 5085 联盟.cpp ├── 5089 小凯的疑惑.cpp ├── 5092 线性代数.cpp ├── 5104 新的世界.cpp ├── 5105 邻面合并.cpp ├── 5106 光线追踪.cpp ├── 5107 merchant.cpp ├── 5125 Forest.cpp ├── 5127 Juice.cpp ├── 5128 迷路.cpp ├── 5130 蛋糕.cpp ├── 5131 LCM.cpp ├── 5132 XOR.cpp ├── 5133 LIS.cpp ├── 5138 graph.cpp ├── 5156 树.cpp ├── 5158 农民.cpp ├── 5159 颜色.cpp ├── 5161 农民.cpp ├── 对拍 │ ├── 3851 渴 │ │ ├── 100.cpp │ │ ├── 30.cpp │ │ └── data.cpp │ ├── 3852 三角形计数 │ │ ├── data.cpp │ │ ├── mine.cpp │ │ └── std.cpp │ ├── 3853 ZCC loves Isaac │ │ ├── data.cpp │ │ ├── isaac.cpp │ │ ├── isaac1.cpp │ │ └── std.cpp │ ├── 3860 Babystep │ │ ├── data.cpp │ │ ├── mine.cpp │ │ └── std.cpp │ ├── 4657 区间 │ │ ├── 1.cpp │ │ ├── 2.cpp │ │ └── 3.cpp │ ├── 4957 量子谜题 │ │ ├── 1.cpp │ │ ├── 2.cpp │ │ └── 3.cpp │ ├── 4963 混合表达式 │ │ ├── 1.cpp │ │ ├── 2.cpp │ │ └── data.cpp │ ├── 4975 保护数列 │ │ ├── 1.cpp │ │ ├── 2.cpp │ │ ├── data.cpp │ │ └── tempCodeRunnerFile.cpp │ ├── 4976 树上行走 │ │ ├── 1.cd │ │ ├── 1.cpp │ │ ├── 2.cpp │ │ ├── 3.cpp │ │ ├── data.cpp │ │ └── tempCodeRunnerFile.cpp │ └── 5043 big │ │ ├── 1.cpp │ │ ├── 2.cpp │ │ └── 3.cpp └── 考试 │ ├── 20181214 │ ├── 1.cpp │ ├── 1_comp.cpp │ ├── 2.cpp │ ├── 2_comp.cpp │ └── 3.cpp │ ├── 20181208 - NOI模拟1 │ ├── 1.cpp │ ├── 1_1.cpp │ ├── 1_2.cpp │ ├── 1_3.cpp │ ├── 2.cpp │ ├── 3.cpp │ ├── Problems.pdf │ └── Solution.pptx │ ├── 20181210 - NOI模拟2 │ ├── 1.cpp │ ├── 1210SOL.ppt │ ├── 2.cpp │ └── 3.cpp │ ├── 20181211 - NOI模拟3 │ ├── 1.cpp │ ├── 1211sol.pptx │ ├── 1_1.cpp │ ├── 1_data.cpp │ ├── 2.cpp │ ├── 3.cpp │ ├── 3_5.cpp │ ├── 3_comp.cpp │ └── 3_data.cpp │ └── 20181212 - NOI模拟赛4 │ ├── 1.cpp │ ├── 2.cpp │ └── 3.cpp ├── LOJ ├── 1 A + B Problem.cpp ├── 1006 传纸条.cpp ├── 101 最大流.cpp ├── 109 并查集.cpp ├── 110 乘法逆元.cpp ├── 119 单源最短路.cpp ├── 127 最大流 加强版.cpp ├── 130 树状数组 1 :单点修改,区间查询.cpp ├── 132. 树状数组 3 :区间修改,区间查询.cpp ├── 133 二维树状数组 1:单点修改,区间查询.cpp ├── 135 二维树状数组 3:区间修改,区间查询.cpp ├── 139 树链剖分.cpp ├── 2 Hello, World!.cpp ├── 2718 「NOI2018」归程.cpp ├── 2822 组合数问题.cpp ├── 3 Copycat.cpp ├── 506「LibreOJ β Round」ZQC 的作业.cpp ├── 6 Guess Number.cpp ├── 6000 「网络流 24 题」搭配飞行员.cpp ├── 6001 「网络流 24 题」太空飞行计划.cpp ├── 6002 「网络流 24 题」最小路径覆盖.cpp ├── 6004 「网络流 24 题」圆桌聚餐.cpp ├── 6005 「网络流 24 题」最长递增子序列.cpp ├── 6029 「雅礼集训 2017 Day1」市场.cpp ├── 6277 数列分块入门 1 - DATA.cpp ├── 6277 数列分块入门 1 - STD.cpp ├── 6277 数列分块入门 1.cpp ├── 6397 「THUPC2018」蛋糕 Cake.cpp ├── 6498 「雅礼集训 2018 Day2」农民.cpp ├── 6499 「雅礼集训 2018 Day2」颜色.cpp └── 7 Input Test.cpp ├── New ├── NowCoder └── contest334 │ ├── a.cpp │ ├── b.cpp │ ├── d.cpp │ ├── e.cpp │ ├── f.cpp │ ├── g.cpp │ ├── i.cpp │ ├── j.cpp │ └── l.cpp ├── README.md ├── Rubbish ├── 1 (2).cpp ├── 1 (3).cpp ├── 1.cpp ├── 1.css ├── 1006 传纸条.cpp ├── 123 (2).cpp ├── 123.cpp ├── 1967 【NOIP模拟赛180325】任务分配.cpp ├── 2.cpp ├── 2026 奉化-1027 上三角数字三角形(一).cpp ├── 2724 联系 Contact.cpp ├── 3.cpp ├── HDU1599.cpp ├── Schrodinger's Knapsack.cpp ├── Treap.cpp ├── Untitled1.cpp ├── chess改编题.cpp ├── demo.cpp ├── get.cpp ├── kmp.cpp ├── manacher.cpp ├── splay.cpp ├── temp.cpp ├── temp001.cpp ├── temp0025.cpp └── tree.cpp ├── Vjudge └── CodeChef GCDTREE.cpp ├── 洛谷 ├── AT1402 N重丸.cpp ├── AT1481 カキ.cpp ├── AT2084 CF.cpp ├── AT211 大好き高橋君.cpp ├── AT2167 Blackout.cpp ├── AT2201 鏡文 _ Mirror String.cpp ├── AT2270 Contest with Drinks Easy.cpp ├── AT2351 Yahoo【过水已隐藏】.cpp ├── AT3529 Theater.cpp ├── AT3572 XXFESTIVAL【过水已隐藏】.cpp ├── AT3595 Minesweeper.cpp ├── AT3599 Addition and Multiplication.cpp ├── AT3675 Lucas Number【过水已隐藏】.cpp ├── AT3718 Shift only【过水已隐藏】.cpp ├── AT3730 Some Sums【过水已隐藏】.cpp ├── AT508 君が望むなら世界中全てのたこ焼きを赤と青に染め上げよう【过水已隐藏】.cpp ├── AT918 スワップ【过水被隐藏】.cpp ├── CF1000F One Occurrence.cpp ├── CF1023A Single Wildcard Pattern Matching.cpp ├── CF1030A In Search of an Easy Problem.cpp ├── CF1030D Vasya and Triangle.cpp ├── CF1041A Heist.cpp ├── CF1041B Buying a TV Set.cpp ├── CF1041C Coffee Break.cpp ├── CF1041D Glider.cpp ├── CF1041E Tree Reconstruction.cpp ├── CF1041F Ray in the tube.cpp ├── CF1044A The Tower is Going Home.cpp ├── CF1044C Optimal Polygon Perimeter.cpp ├── CF1045I Palindrome Pairs.cpp ├── CF1056A Determine Line.cpp ├── CF1056B Divide Candies.cpp ├── CF1056D Decorate Apple Tree.cpp ├── CF1056E Check Transcription.cpp ├── CF1059A Cashier.cpp ├── CF1059B Forgery.cpp ├── CF1059C Sequence Transformation.cpp ├── CF1059D Nature Reserve.cpp ├── CF1059E Split the Tree.cpp ├── CF1060A Phone Numbers.cpp ├── CF1060B Maximum Sum of Digits.cpp ├── CF1060C Maximum Subrectangle.cpp ├── CF1060D Social Circles.cpp ├── CF1060E Sergey and Subway.cpp ├── CF1063A Oh Those Palindromes.cpp ├── CF1063B Labyrinth.cpp ├── CF1063C Dwarves, Hats and Extrasensory Abilities.cpp ├── CF1064A Make a triangle!.cpp ├── CF1064B Equations of Mathematical Magic.cpp ├── CF1065A Vasya and Chocolate.cpp ├── CF1065B Vasya and Isolated Vertices.cpp ├── CF1065C Make It Equal.cpp ├── CF1073A Diverse Substring.cpp ├── CF1073B Vasya and Books.cpp ├── CF1073C Vasya and Robot.cpp ├── CF1073D Berland Fair.cpp ├── CF1077C Good Array.cpp ├── CF1077D Cutting Out.cpp ├── CF1077E Thematic Contests.cpp ├── CF1080A Petya and Origami.cpp ├── CF1080B Margarite and the best present.cpp ├── CF1080C Masha and two friends.cpp ├── CF1080D Olya and magical square.cpp ├── CF1082A Vasya and Book.cpp ├── CF1082B Vova and Trophies.cpp ├── CF1082C Multi-Subject Competition.cpp ├── CF1082D Maximum Diameter Graph.cpp ├── CF1082E Increasing Frequency.cpp ├── CF1082G Petya and Graph.cpp ├── CF1090M The Pleasant Walk.cpp ├── CF1091A New Year and the Christmas Ornament.cpp ├── CF1091B New Year and the Treasure Geolocation.cpp ├── CF1091C New Year and the Sphere Transmission.cpp ├── CF1091D New Year and the Permutation Concatenation.cpp ├── CF121B Lucky Transformation.cpp ├── CF12A Super Agent.cpp ├── CF14A Letter.cpp ├── CF16A Flag.cpp ├── CF194A Exams.cpp ├── CF1A Theatre Square.cpp ├── CF20A BerOS file system.cpp ├── CF271A Beautiful Year.cpp ├── CF27A Next Test.cpp ├── CF292A SMSC.cpp ├── CF327E Axis Walking.cpp ├── CF33A What is for dinner?.cpp ├── CF343D Water Tree.cpp ├── CF34A Reconnaissance 2.cpp ├── CF383A Milking cows.cpp ├── CF387A George and Sleep.cpp ├── CF404D Minesweeper 1D.cpp ├── CF409D Big Data.cpp ├── CF409F 000001.cpp ├── CF40A Find Color.cpp ├── CF4A Watermelon.cpp ├── CF4C Registration system.cpp ├── CF518D Ilya and Escalator.cpp ├── CF527D Clique Problem.cpp ├── CF547C Mike and Foam.cpp ├── CF602B Approximating a Constant Range.cpp ├── CF633H Fibonacci-ish II.cpp ├── CF643D Bearish Fanpages.cpp ├── CF652B z-sort.cpp ├── CF656A Da Vinci Powers.cpp ├── CF656B Scrambled.cpp ├── CF678A Johny Likes Numbers.cpp ├── CF697A Pineapple Incident.cpp ├── CF6A Triangle.cpp ├── CF702E Analysis of Pathes in Functional Graph.cpp ├── CF706E Working routine.cpp ├── CF709A Juicer.cpp ├── CF718C Sasha and Array.cpp ├── CF75A Life Without Zeros.cpp ├── CF776D The Door Problem.cpp ├── CF777A Shell Game.cpp ├── CF845G Shortest Path Problem?.cpp ├── CF859A Declined Finalists.cpp ├── CF914A Perfect Squares.cpp ├── CF914B Conan and Agasa play a Card Game.cpp ├── CF914C Travelling Salesman and Special Numbers.cpp ├── CF914D Bash and a Tough Math Puzzle.cpp ├── CF914E Palindromes in a Tree.cpp ├── CF914F Substrings in a String.cpp ├── CF916E Jamie and Tree.cpp ├── CF986B Petr and Permutations.cpp ├── CF988A Diverse Team.cpp ├── CF990A Commentary Boxes.cpp ├── CF990B Micro-World.cpp ├── CF990C Bracket Sequences Concatenation Problem.cpp ├── CF990D Graph And Its Complement.cpp ├── CF990E Post Lamps.cpp ├── CF990F Flow Control.cpp ├── CF9A Die Roll.cpp ├── P1000 超级玛丽游戏.cpp ├── P1001 A+B Problem.cpp ├── P1002 过河卒.cpp ├── P1003 铺地毯.cpp ├── P1004 方格取数.cpp ├── P1005 矩阵取数游戏.cpp ├── P1006 传纸条.cpp ├── P1007 独木桥.cpp ├── P1008 三连击.cpp ├── P1009 阶乘之和.cpp ├── P1010 幂次方.cpp ├── P1011 车站.cpp ├── P1012 拼数.cpp ├── P1014 Cantor表.cpp ├── P1015 回文数.cpp ├── P1020 导弹拦截.cpp ├── P1022 计算器的改良 .cpp ├── P1025 数的划分.cpp ├── P1028 数的计算.cpp ├── P1029 最大公约数和最小公倍数问题.cpp ├── P1030 求先序排列.cpp ├── P1031 均分纸牌.cpp ├── P1035 级数求和.cpp ├── P1036 选数.cpp ├── P1037 产生数.cpp ├── P1040 加分二叉树.cpp ├── P1042 乒乓球.cpp ├── P1043 数字游戏.cpp ├── P1044 栈.cpp ├── P1045 麦森数.cpp ├── P1046 陶陶摘苹果.cpp ├── P1047 校门外的树.cpp ├── P1048 采药.cpp ├── P1049 装箱问题.cpp ├── P1051 谁拿了最多奖学金.cpp ├── P1052 过河.cpp ├── P1055 ISBN号码.cpp ├── P1056 排座椅.cpp ├── P1058 立体图.cpp ├── P1059 明明的随机数.cpp ├── P1060 开心的金明.cpp ├── P1062 数列.cpp ├── P1063 能量项链.cpp ├── P1064 金明的预算方案.cpp ├── P1067 多项式输出.cpp ├── P1068 分数线划定.cpp ├── P1070 道路游戏.cpp ├── P1071 潜伏者.cpp ├── P1073 最优贸易.cpp ├── P1075 质因数分解.cpp ├── P1079 Vigenère 密码.cpp ├── P1080 国王游戏.cpp ├── P1081 开车旅行.cpp ├── P1082 同余方程.cpp ├── P1083 借教室.cpp ├── P1084 疫情控制.cpp ├── P1085 不高兴的津津.cpp ├── P1086 花生采摘.cpp ├── P1087 FBI树.cpp ├── P1089 津津的储蓄计划.cpp ├── P1090 合并果子.cpp ├── P1091 合唱队形.cpp ├── P1093 奖学金.cpp ├── P1094 纪念品分组.cpp ├── P1096 $Hanoi$双塔问题.cpp ├── P1097 统计数字.cpp ├── P1098 字符串的展开.cpp ├── P1099 树网的核.cpp ├── P1101 单词方阵.cpp ├── P1108 低价购买.cpp ├── P1110 [ZJOI2007]报表统计.cpp ├── P1111 修复公路.cpp ├── P1113 杂务.cpp ├── P1115 最大子段和.cpp ├── P1117 [NOI2016]优秀的拆分 .cpp ├── P1118 [USACO06FEB]数字三角形`Backward Digit Su`….cpp ├── P1119 灾后重建.cpp ├── P1120 小木棍 [数据加强版].cpp ├── P1125 笨小猴.cpp ├── P1134 阶乘问题.cpp ├── P1140 相似基因.cpp ├── P1141 01迷宫.cpp ├── P1144 最短路计数.cpp ├── P1147 连续自然数和.cpp ├── P1149 火柴棒等式.cpp ├── P1150 Peter的烟.cpp ├── P1151 子数整数.cpp ├── P1156 垃圾陷阱.cpp ├── P1162 填涂颜色.cpp ├── P1164 小A点菜.cpp ├── P1165 日志分析.cpp ├── P1169 [ZJOI2007]棋盘制作.cpp ├── P1177 【模板】快速排序.cpp ├── P1179 数字统计.cpp ├── P1181 数列分段Section I.cpp ├── P1190 接水问题.cpp ├── P1192 台阶问题.cpp ├── P1196 [NOI2002]银河英雄传说.cpp ├── P1197 [JSOI2008]星球大战.cpp ├── P1198 [JSOI2008]最大数.cpp ├── P1199 三国游戏.cpp ├── P1200 [USACO1.1]你的飞碟在这儿Your Ride Is He….cpp ├── P1201 [USACO1.1]贪婪的送礼者Greedy Gift Givers.cpp ├── P1202 [USACO1.1]黑色星期五Friday the Thirteenth.cpp ├── P1203 [USACO1.1]坏掉的项链Broken Necklace.cpp ├── P1206 [USACO1.2]回文平方数 Palindromic Squares.cpp ├── P1207 [USACO1.2]双重回文数 Dual Palindromes.cpp ├── P1208 [USACO1.3]混合牛奶 Mixing Milk.cpp ├── P1216 [IOI1999][USACO1.5]数字三角形 Number Triangles.cpp ├── P1217 [USACO1.5]回文质数 Prime Palindromes.cpp ├── P1218 [USACO1.5]特殊的质数肋骨 Superprime Rib.cpp ├── P1219 八皇后.cpp ├── P1220 关路灯 .cpp ├── P1223 排队接水.cpp ├── P1226 【模板】快速幂||取余运算.cpp ├── P1231 教辅的组成.cpp ├── P1233 木棍加工.cpp ├── P1239 计数器.cpp ├── P1250 种树.cpp ├── P1251 餐巾计划问题.cpp ├── P1260 工程规划.cpp ├── P1264 K-联赛.cpp ├── P1288 取数游戏II.cpp ├── P1290 欧几里德的游戏.cpp ├── P1303 A*B Problem.cpp ├── P1305 新二叉树.cpp ├── P1307 数字反转.cpp ├── P1308 统计单词数.cpp ├── P1328 生活大爆炸版石头剪刀布.cpp ├── P1330 封锁阳光大学.cpp ├── P1331 海战.cpp ├── P1334 瑞瑞的木板.cpp ├── P1337 [JSOI2004]平衡点 _ 吊打XXX.cpp ├── P1338 末日的传说 .cpp ├── P1339 [USACO09OCT]热浪Heat Wave.cpp ├── P1341 无序字母对.cpp ├── P1351 联合权值.cpp ├── P1363 幻想迷宫.cpp ├── P1365 WJMZBMR打osu! _ Easy.cpp ├── P1372 又是毕业季I.cpp ├── P1378 油滴扩展.cpp ├── P1387 最大正方形.cpp ├── P1402 酒店之王.cpp ├── P1403 [AHOI2005]约数研究.cpp ├── P1414 又是毕业季II.cpp ├── P1420 最长连号.cpp ├── P1421 小玉买文具.cpp ├── P1422 小玉家的电费.cpp ├── P1423 小玉在游泳.cpp ├── P1424 小鱼的航程(改进版).cpp ├── P1425 小鱼的游泳时间.cpp ├── P1426 小鱼会有危险吗.cpp ├── P1427 小鱼的数字游戏.cpp ├── P1428 小鱼比可爱.cpp ├── P1433 吃奶酪.cpp ├── P1434 [SHOI2002]滑雪.cpp ├── P1438 无聊的数列.cpp ├── P1439 【模板】最长公共子序列.cpp ├── P1441 砝码称重.cpp ├── P1443 马的遍历.cpp ├── P1447 [NOI2010]能量采集.cpp ├── P1452 Beauty Contest.cpp ├── P1463 [POI2002][HAOI2007]反素数.cpp ├── P1464 Function.cpp ├── P1478 陶陶摘苹果(升级版).cpp ├── P1482 Cantor表(升级版).cpp ├── P1484 种树.cpp ├── P1486 [NOI2004]郁闷的出纳员.cpp ├── P1494 [国家集训队]小Z的袜子.cpp ├── P1501 [国家集训队]Tree II.cpp ├── P1503 鬼子进村.cpp ├── P1505 [国家集训队]旅游.cpp ├── P1508 Likecloud-吃、吃、吃.cpp ├── P1510 精卫填海.cpp ├── P1514 引水入城.cpp ├── P1516 青蛙的约会.cpp ├── P1519 穿越栅栏 Overfencing.cpp ├── P1525 关押罪犯.cpp ├── P1529 回家 Bessie Come Home.cpp ├── P1533 可怜的狗狗.cpp ├── P1540 机器翻译.cpp ├── P1541 乌龟棋.cpp ├── P1546 最短网络 Agri-Net.cpp ├── P1548 棋盘问题.cpp ├── P1553 数字反转(升级版).cpp ├── P1554 梦中的统计.cpp ├── P1563 玩具谜题.cpp ├── P1567 统计天数.cpp ├── P1577 切绳子.cpp ├── P1579 哥德巴赫猜想(升级版).cpp ├── P1580 yyy loves Easter_Egg I.cpp ├── P1582 倒水.cpp ├── P1583 魔法照片.cpp ├── P1598 垂直柱状图.cpp ├── P1600 天天爱跑步.cpp ├── P1601 A+B Problem(高精).cpp ├── P1603 斯诺登的密码.cpp ├── P1613 跑路.cpp ├── P1615 西游记公司.cpp ├── P1616 疯狂的采药.cpp ├── P1618 三连击(升级版).cpp ├── P1627 [CQOI2009]中位数.cpp ├── P1631 序列合并.cpp ├── P1634 禽兽的传染病.cpp ├── P1641 [SCOI2010]生成字符串.cpp ├── P1712 [NOI2016]区间.cpp ├── P1720 月落乌啼算钱.cpp ├── P1726 上白泽慧音.cpp ├── P1736 创意吃鱼法.cpp ├── P1738 洛谷的文件夹.cpp ├── P1739 表达式括号匹配.cpp ├── P1772 [ZJOI2006]物流运输.cpp ├── P1781 宇宙总统.cpp ├── P1789 【Mc生存】插火把.cpp ├── P1792 [国家集训队]种树.cpp ├── P1801 黑匣子_NOI导刊2010提高(06).cpp ├── P1804 【保留题目】.cpp ├── P1807 最长路_NOI导刊2010提高(07).cpp ├── P1847 轰炸II.cpp ├── P1850 换教室.cpp ├── P1854 花店橱窗布置.cpp ├── P1855 榨取kkksc03.cpp ├── P1856 [USACO5.5]矩形周长Picture.cpp ├── P1865 A % B Problem.cpp ├── P1877 [HAOI2012]音量调节.cpp ├── P1879 [USACO06NOV]玉米田Corn Fields.cpp ├── P1880 [NOI1995]石子合并.cpp ├── P1888 三角函数.cpp ├── P1894 [USACO4.2]完美的牛栏The Perfect Stall.cpp ├── P1896 [SCOI2005]互不侵犯.cpp ├── P1901 发射站.cpp ├── P1903 [国家集训队]数颜色 _ 维护队列.cpp ├── P1908 逆序对.cpp ├── P1909 买铅笔.cpp ├── P1914 小书童——密码.cpp ├── P1919 【模板】A*B Problem升级版(FFT快速傅里叶).cpp ├── P1921 赌博游戏.cpp ├── P1932 A+B A-B A*B A_B A%B Problem.cpp ├── P1939 【模板】矩阵加速(数列).cpp ├── P1941 飞扬的小鸟 .cpp ├── P1948 [USACO08JAN]电话线Telephone Lines.cpp ├── P1955 [NOI2015]程序自动分析.cpp ├── P1962 斐波那契数列.cpp ├── P1965 转圈游戏.cpp ├── P1966 火柴排队.cpp ├── P1967 货车运输.cpp ├── P1969 积木大赛.cpp ├── P1970 花匠.cpp ├── P1972 [SDOI2009]HH的项链.cpp ├── P1975 [国家集训队]排队.cpp ├── P1979 华容道 .cpp ├── P1980 计数问题.cpp ├── P1981 表达式求值 .cpp ├── P1983 车站分级 .cpp ├── P1984 [SDOI2008]烧水问题.cpp ├── P1991 无线通讯网.cpp ├── P1993 小K的农场.cpp ├── P1996 约瑟夫问题.cpp ├── P2005 A_B Problem II.cpp ├── P2010 回文日期.cpp ├── P2014 选课.cpp ├── P2018 消息传递.cpp ├── P2023 [AHOI2009]维护序列.cpp ├── P2025 脑力大人之监听电话.cpp ├── P2038 无线网络发射器选址.cpp ├── P2042 [NOI2005]维护数列.cpp ├── P2044 [NOI2012]随机数生成器.cpp ├── P2051 [AHOI2009]中国象棋.cpp ├── P2052 [NOI2011]道路修建 .cpp ├── P2053 [SCOI2007]修车.cpp ├── P2055 [ZJOI2009]假期的宿舍.cpp ├── P2056 [ZJOI2007]捉迷藏 .cpp ├── P2058 海港.cpp ├── P2059 [JLOI2013]卡牌游戏.cpp ├── P2073 送花.cpp ├── P2085 最小函数值.cpp ├── P2089 烤鸡.cpp ├── P2114 [NOI2014]起床困难综合症.cpp ├── P2118 比例简化.cpp ├── P2120 [ZJOI2007]仓库建设.cpp ├── P2123 皇后游戏.cpp ├── P2141 珠心算测验.cpp ├── P2142 高精度减法.cpp ├── P2144 [FJOI2007]轮状病毒.cpp ├── P2146 [NOI2015]软件包管理器.cpp ├── P2147 [SDOI2008]洞穴勘测.cpp ├── P2148 [SDOI2009]E&D.cpp ├── P2151 [SDOI2009]HH去散步.cpp ├── P2152 [SDOI2009]SuperGCD.cpp ├── P2153 [SDOI2009]晨跑.cpp ├── P2158 [SDOI2008]仪仗队.cpp ├── P2163 [SHOI2007]园丁的烦恼.cpp ├── P2168 [NOI2015]荷马史诗.cpp ├── P2173 [ZJOI2012]网络.cpp ├── P2178 [NOI2015]品酒大会.cpp ├── P2192 HXY玩卡片.cpp ├── P2197 【模板】nim游戏.cpp ├── P2216 [HAOI2007]理想的正方形.cpp ├── P2219 [HAOI2007]修筑绿化带.cpp ├── P2220 [HAOI2012]容易题.cpp ├── P2225 [HNOI2001]棋盘变换.cpp ├── P2234 [HNOI2002]营业额统计.cpp ├── P2239 螺旋矩阵.cpp ├── P2255 [USACO14JAN]记录奥林比克Recording the M….cpp ├── P2257 YY的GCD.cpp ├── P2260 [清华集训2012]模积和.cpp ├── P2261 [CQOI2007]余数求和.cpp ├── P2278 [HNOI2003]操作系统.cpp ├── P2279 [HNOI2003]消防局的设立.cpp ├── P2280 [HNOI2003]激光炸弹.cpp ├── P2285 [HNOI2004]打鼹鼠.cpp ├── P2286 [HNOI2004]宠物收养场.cpp ├── P2294 [HNOI2005]狡猾的商人.cpp ├── P2296 寻找道路.cpp ├── P2303 [SDOi2012]Longge的问题.cpp ├── P2312 解方程.cpp ├── P2320 [HNOI2006]鬼谷子的钱袋.cpp ├── P2324 [SCOI2005]骑士精神.cpp ├── P2325 [SCOI2005]王室联邦.cpp ├── P2327 [SCOI2005]扫雷.cpp ├── P2330 [SCOI2005]繁忙的都市.cpp ├── P2331 [SCOI2005]最大子矩阵.cpp ├── P2336 [SCOI2012]喵星球上的点名.cpp ├── P2341 [HAOI2006]受欢迎的牛.cpp ├── P2347 砝码称重.cpp ├── P2371 [国家集训队]墨墨的等式.cpp ├── P2376 [USACO09OCT]津贴Allowance.cpp ├── P2382 化学分子式.cpp ├── P2387 [NOI2014]魔法森林.cpp ├── P2393 yyy loves Maths II.cpp ├── P2394 yyy loves Chemistry I.cpp ├── P2396 yyy loves Maths VII.cpp ├── P2397 yyy loves Maths VI (mode).cpp ├── P2420 让我们异或吧.cpp ├── P2434 [SDOI2005]区间.cpp ├── P2447 [SDOI2010]外星千足虫.cpp ├── P2455 [SDOI2006]线性方程组.cpp ├── P2463 [SDOI2008]Sandy的卡片.cpp ├── P2467 [SDOI2010]地精部落.cpp ├── P2468 [SDOI2010]粟粟的书架.cpp ├── P2469 [SDOI2010]星际竞速.cpp ├── P2472 [SCOI2007]蜥蜴.cpp ├── P2485 [SDOI2011]计算器.cpp ├── P2486 [SDOI2011]染色.cpp ├── P2495 [SDOI2011]消耗战.cpp ├── P2502 [HAOI2006]旅行.cpp ├── P2512 [HAOI2008]糖果传递.cpp ├── P2518 [HAOI2010]计数.cpp ├── P2522 [HAOI2011]Problem b.cpp ├── P2540 斗地主增强版.cpp ├── P2564 [SCOI2009]生日礼物.cpp ├── P2568 GCD.cpp ├── P2572 [SCOI2010]序列操作.cpp ├── P2573 [SCOI2012]滑雪.cpp ├── P2574 XOR的艺术.cpp ├── P2577 [ZJOI2005]午餐.cpp ├── P2585 [ZJOI2006]三色二叉树.cpp ├── P2587 [ZJOI2008]泡泡堂.cpp ├── P2590 [ZJOI2008]树的统计.cpp ├── P2591 [ZJOI2009]函数.cpp ├── P2596 [ZJOI2006]书架.cpp ├── P2600 [ZJOI2008]瞭望塔.cpp ├── P2602 [ZJOI2010]数字计数.cpp ├── P2604 [ZJOI2010]网络扩容.cpp ├── P2606 [ZJOI2010]排列计数.cpp ├── P2613 【模板】有理数取余.cpp ├── P2615 神奇的幻方.cpp ├── P2617 Dynamic Rankings.cpp ├── P2626 斐波那契数列(升级版).cpp ├── P2627 修剪草坪.cpp ├── P2633 Count on a tree.cpp ├── P2634 [国家集训队]聪聪可可.cpp ├── P2639 [USACO09OCT]Bessie的体重问题Bessie's We….cpp ├── P2642 双子序列最大和.cpp ├── P2657 [SCOI2009]windy数.cpp ├── P2658 汽车拉力比赛.cpp ├── P2661 信息传递.cpp ├── P2664 树上游戏.cpp ├── P2668 斗地主.cpp ├── P2669 金币.cpp ├── P2670 扫雷游戏.cpp ├── P2671 求和.cpp ├── P2676 超级书架.cpp ├── P2678 跳石头.cpp ├── P2679 子串.cpp ├── P2680 运输计划.cpp ├── P2681 众数.cpp ├── P2698 [USACO12MAR]花盆Flowerpot.cpp ├── P2704 [NOI2001]炮兵阵地.cpp ├── P2706 巧克力.cpp ├── P2709 小B的询问.cpp ├── P2722 总分 Score Inflation.cpp ├── P2730 魔板 Magic Squares.cpp ├── P2736 “破锣摇滚”乐队 Raucous Rockers.cpp ├── P2740 [USACO4.2]草地排水Drainage Ditches.cpp ├── P2742 【模板】二维凸包 _ [USACO5.1]圈奶牛Fencing the Cows.cpp ├── P2746 [USACO5.3]校园网Network of Schools.cpp ├── P2754 [CTSC1999]家园.cpp ├── P2756 飞行员配对方案问题.cpp ├── P2757 [国家集训队]等差子序列.cpp ├── P2761 软件补丁问题.cpp ├── P2762 太空飞行计划问题.cpp ├── P2763 试题库问题.cpp ├── P2764 最小路径覆盖问题.cpp ├── P2765 魔术球问题.cpp ├── P2766 最长不下降子序列问题.cpp ├── P2770 航空路线问题.cpp ├── P2774 方格取数问题.cpp ├── P2783 有机化学之神偶尔会做作弊.cpp ├── P2787 语文1(chin1)- 理理思维.cpp ├── P2788 数学1(math1)- 加减算式.cpp ├── P2801 教主的魔法.cpp ├── P2822 组合数问题.cpp ├── P2827 蚯蚓.cpp ├── P2831 愤怒的小鸟.cpp ├── P2839 [国家集训队]middle.cpp ├── P2846 [USACO08NOV]光开关Light Switching.cpp ├── P2871 [USACO07DEC]手链Charm Bracelet.cpp ├── P2893 [USACO08FEB]修路Making the Grade.cpp ├── P2894 [USACO08FEB]酒店Hotel.cpp ├── P2911 [USACO08OCT]牛骨头Bovine Bones.cpp ├── P2921 [USACO08DEC]在农场万圣节Trick or Treat on the Farm.cpp ├── P2936 [USACO09JAN]全流Total Flow.cpp ├── P2939 [USACO09FEB]改造路Revamping Trails.cpp ├── P2955 [USACO09OCT]奇数偶数Even? Odd? .cpp ├── P2962 [USACO09NOV]灯Lights.cpp ├── P2982 [USACO10FEB]慢下来Slowing down.cpp ├── P2996 [USACO10NOV]拜访奶牛Visiting Cows.cpp ├── P3004 [USACO10DEC]宝箱Treasure Chest.cpp ├── P3007 [USACO11JAN]大陆议会The Continental Cowngress.cpp ├── P3028 [USACO10OCT]汽水机Soda Machine.cpp ├── P3038 [USACO11DEC]牧草种植Grass Planting.cpp ├── P3067 [USACO12OPEN]平衡的奶牛群Balanced Cow S….cpp ├── P3071 [USACO13JAN]座位Seating.cpp ├── P3074 [USACO13FEB]牛奶调度Milk Scheduling.cpp ├── P3084 [USACO13OPEN]照片Photo.cpp ├── P3085 [USACO13OPEN]阴和阳Yin and Yang.cpp ├── P3106 [USACO14OPEN]GPS的决斗Dueling GPS's.cpp ├── P3114 [USACO15JAN]踩踏Stampede.cpp ├── P3116 [USACO15JAN]约会时间Meeting Time.cpp ├── P3119 [USACO15JAN]草鉴定Grass Cownoisseur.cpp ├── P3120 [USACO15FEB]牛跳房子(金)Cow Hopscotch (Gold).cpp ├── P3128 [USACO15DEC]最大流Max Flow.cpp ├── P3130 [USACO15DEC]计数haybalesCounting Haybales.cpp ├── P3157 [CQOI2011]动态逆序对.cpp ├── P3165 [CQOI2014]排序机械臂.cpp ├── P3166 [CQOI2014]数三角形.cpp ├── P3168 [CQOI2015]任务查询系统.cpp ├── P3178 [HAOI2015]树上操作.cpp ├── P3181 [HAOI2016]找相同字符.cpp ├── P3183 [HAOI2016]食物链.cpp ├── P3194 [HNOI2008]水平可见直线.cpp ├── P3195 [HNOI2008]玩具装箱TOY.cpp ├── P3197 [HNOI2008]越狱.cpp ├── P3203 [HNOI2010]弹飞绵羊.cpp ├── P3217 [HNOI2011]数矩形.cpp ├── P3224 [HNOI2012]永无乡.cpp ├── P3250 [HNOI2016]网络.cpp ├── P3254 圆桌问题.cpp ├── P3258 [JLOI2014]松鼠的新家.cpp ├── P3265 [JLOI2015]装备购买.cpp ├── P3275 [SCOI2011]糖果.cpp ├── P3285 [SCOI2014]方伯伯的OJ.cpp ├── P3303 [SDOI2013]淘金.cpp ├── P3313 [SDOI2014]旅行.cpp ├── P3324 [SDOI2015]星际战争.cpp ├── P3327 [SDOI2015]约数个数和.cpp ├── P3332 [ZJOI2013]K大数查询.cpp ├── P3338 [ZJOI2014]力.cpp ├── P3345 [ZJOI2015]幻想乡战略游戏.cpp ├── P3355 骑士共存问题.cpp ├── P3356 火星探险问题 .cpp ├── P3358 最长k可重区间集问题.cpp ├── P3366 【模板】最小生成树.cpp ├── P3367 【模板】并查集.cpp ├── P3368 【模板】树状数组 2.cpp ├── P3369 【模板】普通平衡树.cpp ├── P3370 【模板】字符串哈希.cpp ├── P3371 【模板】单源最短路径(弱化版).cpp ├── P3372 【模板】线段树 1.cpp ├── P3373 【模板】线段树 2.cpp ├── P3374 【模板】树状数组 1.cpp ├── P3375 【模板】KMP字符串匹配.cpp ├── P3376 【模板】网络最大流.cpp ├── P3377 【模板】左偏树(可并堆).cpp ├── P3378 【模板】堆.cpp ├── P3379 【模板】最近公共祖先(LCA).cpp ├── P3380 【模板】二逼平衡树(树套树).cpp ├── P3381 【模板】最小费用最大流.cpp ├── P3382 【模板】三分法.cpp ├── P3383 【模板】线性筛素数.cpp ├── P3384 【模板】树链剖分.cpp ├── P3385 【模板】负环.cpp ├── P3386 【模板】二分图匹配.cpp ├── P3387 【模板】缩点.cpp ├── P3388 【模板】割点(割顶).cpp ├── P3389 【模板】高斯消元法.cpp ├── P3390 【模板】矩阵快速幂.cpp ├── P3391 【模板】文艺平衡树(Splay).cpp ├── P3396 哈希冲突.cpp ├── P3402 【模板】可持久化并查集.cpp ├── P3403 跳楼机.cpp ├── P3411 序列变换.cpp ├── P3455 [POI2007]ZAP-Queries.cpp ├── P3469 [POI2008]BLO-Blockade.cpp ├── P3527 [POI2011]MET-Meteors.cpp ├── P3558 [POI2013]BAJ-Bytecomputer.cpp ├── P3567 [POI2014]KUR-Couriers.cpp ├── P3604 美好的每一天.cpp ├── P3620 [APIO_CTSC 2007]数据备份.cpp ├── P3623 [APIO2008]免费道路.cpp ├── P3627 [APIO2009]抢掠计划.cpp ├── P3628 [APIO2010]特别行动队 .cpp ├── P3648 [APIO2014]序列分割.cpp ├── P3649 [APIO2014]回文串.cpp ├── P3674 小清新人渣的本愿.cpp ├── P3690 【模板】Link Cut Tree (动态树).cpp ├── P3701 「伪模板」主席树.cpp ├── P3709 大爷的字符串题.cpp ├── P3714 [BJOI2017]树的难题.cpp ├── P3720 [AHOI2017初中组]guide.cpp ├── P3723 [AH2017_HNOI2017]礼物.cpp ├── P3740 [HAOI2014]贴海报.cpp ├── P3742 umi的函数.cpp ├── P3744 李彬的几何.cpp ├── P3759 [TJOI2017]不勤劳的图书管理员.cpp ├── P3768 简单的数学题.cpp ├── P3792 由乃与大母神原型和偶像崇拜.cpp ├── P3796 【模板】AC自动机(加强版).cpp ├── P3803 【模板】多项式乘法(FFT).cpp ├── P3804 【模板】后缀自动机.cpp ├── P3805 【模板】manacher算法.cpp ├── P3806 【模板】点分治1.cpp ├── P3807 【模板】卢卡斯定理.cpp ├── P3808 【模板】AC自动机(简单版).cpp ├── P3809 【模板】后缀排序.cpp ├── P3810 【模板】三维偏序(陌上花开).cpp ├── P3811 【模板】乘法逆元.cpp ├── P3812 【模板】线性基.cpp ├── P3825 [NOI2017]游戏.cpp ├── P3833 [SHOI2012]魔法树.cpp ├── P3834 【模板】可持久化线段树 1(主席树).cpp ├── P3835 【模板】可持久化平衡树.cpp ├── P3853 [TJOI2007]路标设置.cpp ├── P3857 [TJOI2008]彩灯.cpp ├── P3865 【模板】ST表.cpp ├── P3870 [TJOI2009]开关.cpp ├── P3871 [TJOI2010]中位数.cpp ├── P3875 [TJOI2010]被污染的河流.cpp ├── P3918 [国家集训队]特技飞行.cpp ├── P3919 【模板】可持久化数组(可持久化线段树_平衡树).cpp ├── P3939 数颜色.cpp ├── P3941 入阵曲.cpp ├── P3942 将军令.cpp ├── P3943 星空.cpp ├── P3950 部落冲突.cpp ├── P3951 小凯的疑惑.cpp ├── P3952 时间复杂度 .cpp ├── P3953 逛公园.cpp ├── P3954 成绩.cpp ├── P3955 图书管理员.cpp ├── P3956 棋盘.cpp ├── P3957 跳房子.cpp ├── P3958 奶酪.cpp ├── P3959 宝藏.cpp ├── P3960 列队.cpp ├── P3976 [TJOI2015]旅游.cpp ├── P3978 [TJOI2015]概率论.cpp ├── P3979 遥远的国度.cpp ├── P3980 [NOI2008]志愿者招募.cpp ├── P4001 [BJOI2006]狼抓兔子.cpp ├── P4008 [NOI2003]文本编辑器.cpp ├── P4009 汽车加油行驶问题.cpp ├── P4011 孤岛营救问题.cpp ├── P4012 深海机器人问题.cpp ├── P4013 数字梯形问题.cpp ├── P4014 分配问题.cpp ├── P4015 运输问题.cpp ├── P4016 负载平衡问题.cpp ├── P4066 [SHOI2003]吃豆豆.cpp ├── P4074 [WC2013]糖果公园.cpp ├── P4075 [SDOI2016]模式字符串.cpp ├── P4092 [HEOI2016_TJOI2016]树.cpp ├── P4094 [HEOI2016_TJOI2016]字符串.cpp ├── P4114 Qtree1.cpp ├── P4115 Qtree4.cpp ├── P4116 Qtree3.cpp ├── P4121 [WC2005]双面棋盘.cpp ├── P4135 作诗.cpp ├── P4137 Rmq Problem _ mex.cpp ├── P4139 上帝与集合的正确用法.cpp ├── P4141 消失之物.cpp ├── P4145 上帝造题的七分钟2 _ 花神游历各国.cpp ├── P4146 序列终结者.cpp ├── P4148 简单题.cpp ├── P4149 [IOI2011]Race.cpp ├── P4151 [WC2011]最大XOR和路径.cpp ├── P4159 [SCOI2009]迷路.cpp ├── P4168 [Violet]蒲公英.cpp ├── P4169 [Violet]天使玩偶_SJY摆棋子.cpp ├── P4172 [WC2006]水管局长.cpp ├── P4173 残缺的字符串.cpp ├── P4174 [NOI2006]最大获利.cpp ├── P4178 Tree.cpp ├── P4180 【模板】严格次小生成树[BJWC2010].cpp ├── P4183 [USACO18JAN]Cow at Large P.cpp ├── P4195 【模板】exBSGS_Spoj3105 Mod.cpp ├── P4197 Peaks.cpp ├── P4199 万径人踪灭.cpp ├── P4211 [LNOI2014]LCA.cpp ├── P4213 【模板】杜教筛(Sum).cpp ├── P4215 踩气球.cpp ├── P4219 [BJOI2014]大融合.cpp ├── P4234 最小差值生成树.cpp ├── P4238 【模板】多项式求逆.cpp ├── P4245 【模板】任意模数NTT.cpp ├── P4247 [清华集训]序列操作.cpp ├── P4281 [AHOI2008]紧急集合 _ 聚会.cpp ├── P4289 [HAOI2008]移动玩具.cpp ├── P4303 [AHOI2006]基因匹配.cpp ├── P4305 [JLOI2011]不重复数字.cpp ├── P4310 绝世好题.cpp ├── P4312 [COCI 2009] OTOCI _ 极地旅行社.cpp ├── P4316 绿豆蛙的归宿.cpp ├── P4317 花神的数论题.cpp ├── P4320 道路相遇.cpp ├── P4325 [COCI2006-2007#1] Modulo.cpp ├── P4344 [SHOI2015]脑洞治疗仪.cpp ├── P4346 [CERC2015]ASCII Addition.cpp ├── P4374 [USACO18OPEN]Disruption.cpp ├── P4390 [BOI2007]Mokia 摩基亚.cpp ├── P4396 [AHOI2013]作业.cpp ├── P4402 [Cerc2007]robotic sort 机械排序.cpp ├── P4413 [COCI2006-2007#2] R2.cpp ├── P4427 [BJOI2018]求和.cpp ├── P4450 双亲数.cpp ├── P4475 巧克力王国.cpp ├── P4503 [CTSC2014]企鹅QQ.cpp ├── P4513 小白逛公园.cpp ├── P4514 上帝造题的七分钟.cpp ├── P4516 [JSOI2018]潜入行动.cpp ├── P4528 [CTSC2008]图腾.cpp ├── P4549 【模板】裴蜀定理.cpp ├── P4550 收集邮票.cpp ├── P4551 最长异或路径.cpp ├── P4555 [国家集训队]最长双回文串.cpp ├── P4556 [Vani有约会]雨天的尾巴.cpp ├── P4567 [AHOI2006]文本编辑器.cpp ├── P4571 [JSOI2009]瓶子和燃料.cpp ├── P4597 序列sequence.cpp ├── P4606 [SDOI2018]战略游戏.cpp ├── P4609 [FJOI2016]建筑师.cpp ├── P4630 [APIO2018] Duathlon 铁人两项.cpp ├── P4688 [Ynoi2016]掉进兔子洞.cpp ├── P4718 【模板】Pollard-Rho算法.cpp ├── P4719 【模板】动态dp.cpp ├── P4735 最大异或和.cpp ├── P4751 动态dp【加强版】.cpp ├── P4767 [IOI2000]邮局.cpp ├── P4768 [NOI2018]归程.cpp ├── P4777 【模板】扩展中国剩余定理(EXCRT).cpp ├── P4779 【模板】单源最短路径(标准版).cpp ├── P4781 【模板】拉格朗日插值.cpp ├── P4782 【模板】2-SAT 问题.cpp ├── P4825 [USACO15FEB]Cow Hopscotch (Silver) 牛跳房子(银).cpp ├── P4826 [USACO15FEB]Superbull 超级牛.cpp ├── P4868 Preprefix sum.cpp ├── P4878 [USACO05DEC]layout布局.cpp ├── P4884 多少个1?.cpp ├── P4894 GodFly求解法向量.cpp ├── P4899 [IOI2018] werewolf 狼人.cpp ├── P4924 [1007]魔法少女小Scarlet.cpp ├── P4925 [1007]Scarlet的字符串不可能这么可爱.cpp ├── P4930 「FJ2014集训」采药人的路径.cpp ├── P4936 Agent1.cpp ├── P4937 Portal1.cpp ├── P4938 War1.cpp ├── P4939 Agent2.cpp ├── P4940 Portal2.cpp ├── P4941 War2.cpp ├── P4949 最短距离.cpp ├── P4994 终于结束的起点.cpp ├── P4995 跳跳!.cpp ├── P4996 咕咕咕.cpp ├── P4997 不围棋.cpp ├── P5002 专心OI - 找祖先.cpp ├── P5015 标题统计.cpp ├── P5018 对称二叉树.cpp ├── P5019 铺设道路.cpp ├── P5020 货币系统.cpp ├── P5021 赛道修建.cpp ├── P5022 旅行.cpp ├── P5025 [SNOI2017]炸弹.cpp ├── P5035 金坷垃.cpp ├── P5046 [Ynoi2019模拟赛]Yuno loves sqrt technology I.cpp ├── P5048 [Ynoi2019模拟赛]Yuno loves sqrt technology III.cpp ├── P5055 【模板】可持久化文艺平衡树.cpp ├── P5056 【模板】插头dp.cpp ├── P5057 [CQOI2006]简单题.cpp ├── P5071 [Ynoi2015]此时此刻的光辉.cpp ├── P5081 Tweetuzki 爱取球.cpp ├── P5091 【模板】欧拉定理.cpp ├── P5104 红包发红包.cpp ├── P5105 不强制在线的动态快速排序.cpp ├── P5106 dkw的lcm.cpp ├── P5107 能量采集.cpp ├── P5110 块速递推.cpp ├── P5116 [USACO18DEC]Mixing Milk.cpp ├── SP1 TEST - Life, the Universe, and Everything.cpp ├── SP1043 GSS1 - Can you answer these queries I.cpp ├── SP11469 SUBSET - Balanced Cow Subsets.cpp ├── SP11470 TTM - To the moon.cpp ├── SP1487 PT07J - Query on a tree III.cpp ├── SP1716 GSS3 - Can you answer these queries III.cpp ├── SP2059 CERC07S - Robotic Sort.cpp ├── SP2666 QTREE4 - Query on a tree IV.cpp ├── SP2713 GSS4 - Can you answer these queries IV.cpp ├── SP27561 GDCOFTI - Greatest Common Divisor Of Three Integers.cpp ├── SP2916 GSS5 - Can you answer these queries V.cpp ├── SP3105 MOD - Power Modulo Inverted.cpp ├── SP3266 KQUERY - K-query.cpp ├── SP3267 DQUERY - D-query.cpp ├── SP3868 MTOTALF - Total Flow.cpp ├── SP3978 DISQUERY - Distance Query.cpp ├── SP4155 OTOCI - OTOCI.cpp ├── SP4487 GSS6 - Can you answer these queries VI.cpp ├── SP6779 GSS7 - Can you answer these queries VII.cpp ├── SP7259 LITE - Light Switching.cpp ├── T15222 A+b问题.cpp ├── T16843 【普及】zxy防巨人.cpp ├── T17379 #024 【模板】进制转换.cpp ├── T22685 #045 【模板】最短路(热浪).cpp ├── T22686 #046 【模板】最小生成树.cpp ├── T23005 【提高-】【模板】Tarjan.cpp ├── T23806 [愚人节题目4]Sum of a and b.cpp ├── T30159 [BZOJ1000] A+B Problem.cpp ├── T30161 [LJOJ2141] [NOIP2012模拟赛No.9]序列一.cpp ├── T30163 [LJOJ2142] [NOIP2012模拟赛No.9]序列二.cpp ├── T30164 [LJOJ2143] [NOIP2012模拟赛No.9]算式恢复.cpp ├── T31191 [LJOJ2129] [NOIP2012模拟赛No.7]dna.cpp ├── T31194 [LJOJ2155] [NOIP2012模拟赛No.11]蜜蜂繁殖.cpp ├── T36196 【BOR-08】求10000以内n的阶乘.cpp ├── T54933 algebra(附半成 spj).cpp ├── T63719 Chino的数学题.cpp ├── U16000 自然数螺旋矩阵.cpp ├── U24306 tree.cpp ├── U31655 [NOI2018]归程.cpp ├── U37211 回路.cpp ├── U41741 SPJ 测试.cpp ├── UVA100 The 3n + 1 problem.cpp ├── UVA10228 A Star not a Tree?.cpp ├── UVA11990 ``Dynamic'' Inversion.cpp ├── UVA1220 Hali-Bula的晚会 Party at Hali-Bula.cpp ├── UVA12538 自带版本控制功能的IDE Version Controlled IDE.cpp ├── UVA1402 Robotic Sort.cpp ├── UVA1479 Graph and Queries.cpp ├── UVA151 Power Crisis.cpp ├── UVA307 小木棍 Sticks.cpp └── UVA679 小球下落 Dropping Balls.cpp └── 白马湖OJ ├── 1000 白马湖欢迎你.cpp ├── 1001 设计爱心.cpp ├── 1002 字符菱形.cpp ├── 1003 对齐输出.cpp ├── 1004 浮点数输出.cpp ├── 1005 简易加法器.cpp ├── 1006.cpp ├── 1007.cpp ├── 1008.cpp ├── 1009.cpp ├── 1010.cpp ├── 1017.cpp ├── 1030.cpp ├── 1031.cpp ├── 1032.cpp ├── 1033.cpp ├── 1034.cpp ├── 1035.cpp ├── 1036.cpp ├── 1037.cpp ├── 1038.cpp ├── 1039.cpp ├── 1040.cpp ├── 1051.cpp ├── 1060.cpp ├── 1061.cpp ├── 1062.cpp ├── 1063.cpp ├── 1064.cpp ├── 1065.cpp ├── 1065_2.cpp ├── 1067.cpp ├── 1069.cpp ├── 1070.cpp ├── 1071.cpp ├── 1072.cpp ├── 1073.cpp ├── 1074.cpp ├── 1075.cpp ├── 1076.cpp ├── 1076_2.cpp ├── 1077.cpp ├── 1078.cpp ├── 1079.cpp ├── 1080.cpp ├── 1081.cpp ├── 1082.cpp ├── 1082_12.cpp ├── 1083 家具.cpp ├── 1098.cpp ├── 1099.cpp ├── 1100.cpp ├── 1101.cpp ├── 1101_2.cpp ├── 1102.cpp ├── 1103 智力竞赛.cpp ├── 1104 结伴同行去秋游.cpp ├── 1105 摘苹果.cpp ├── 1106 计算书费.cpp ├── 1107 数组元素的移动.cpp ├── 1108 数组元素的删除.cpp ├── 1109 数组元素的查找.cpp ├── 1110 元素插入有序数组.cpp ├── 1111 小李打台球.cpp ├── 1112 数组排序.cpp ├── 1113 字母统计.cpp ├── 1115 校门外的树.cpp ├── 1116 整数去重.cpp ├── 1117 考试分数中的众数.cpp ├── 1118 什么时候开会.cpp ├── 1119 吃水果问题.cpp ├── 1120 英雄卡.cpp ├── 1121 伙伴.cpp ├── 1122.cpp ├── 1123 排队接水.cpp ├── 1123.cpp ├── 1124 图像相似度.cpp ├── 1125 对角线加法.cpp ├── 1126 矩阵交换.cpp ├── 1127 杨辉三角.cpp ├── 1128 螺旋矩阵.cpp ├── 1129.cpp ├── 1130.cpp ├── 1130_2.cpp ├── 1131 百团大战.cpp ├── 1131.cpp ├── 1132.cpp ├── 1133.cpp ├── 1133_2.cpp ├── 1135 翻转排序.cpp ├── 1137.cpp ├── 1138 排名新规则.cpp ├── 1138.cpp ├── 1150.cpp ├── 1151.cpp ├── 1152.cpp ├── 1153.cpp ├── 1154.cpp ├── 1155.cpp ├── 1156.cpp ├── 1157.cpp ├── 1158.cpp ├── 1159.cpp ├── 1160.cpp ├── 1161.cpp ├── 1162.cpp ├── 1163.cpp ├── 1164.cpp ├── 1164_2.cpp ├── 1164_3.cpp ├── 1165.cpp ├── 1166.cpp ├── 1167.cpp ├── 1168.cpp ├── 1169 求约数个数【语言基础测试1】.cpp ├── 1169.cpp ├── 1170 数列【语言基础测试1】.cpp ├── 1171 装牛奶的桶【语言基础测试1】.cpp ├── 1172 数字统计【语言基础测试2】.cpp ├── 1173 上三角数字三角形【语言基础测试2】.cpp ├── 1174 计数再现【语言基础测试2】.cpp ├── 1175 哈弗曼编码【语言基础测试2】.cpp ├── 1185 加数.cpp ├── 1186 连续数的和.cpp ├── 1187 分数计数.cpp ├── 1188 哨兵.cpp ├── 1189 加入数.cpp ├── 1190 接水问题.cpp ├── 1199 数数.cpp ├── 1200.cpp ├── 1201.cpp ├── 1202.cpp ├── 1203.cpp ├── 1204.cpp ├── 1205.cpp ├── 1206.cpp ├── 1207.cpp ├── 1208.cpp ├── 1209.cpp ├── 1209_2.cpp ├── 1210.cpp ├── 1210_2.cpp ├── 1211.cpp ├── 1212.cpp ├── 1212_2.cpp ├── 1213.cpp ├── 1214.cpp ├── 1214_2.cpp ├── 1214_3.cpp ├── 1215.cpp ├── 1215_2.cpp ├── 1216.cpp ├── 1216_2.cpp ├── 1217.cpp ├── 1217_2.cpp ├── 1217_3.cpp ├── 1217_4.cpp ├── 1217_5.cpp ├── 1218.cpp ├── 1219.cpp ├── 1220.cpp ├── 1221.cpp ├── 1224 汽车拉力比赛.cpp ├── 1270.cpp ├── 1271.cpp ├── 1272.cpp ├── 1273.cpp ├── 1273_2.cpp ├── 1273_3.cpp ├── 1274.cpp ├── 1275.cpp ├── 1276.cpp ├── 1277.cpp ├── 1290 高精度加法 模板题.cpp ├── 1290.cpp ├── 1290_2.cpp ├── 1290_3.cpp ├── 1291 高精度减法 模板题.cpp ├── 1291.cpp ├── 1292 高精度乘法 模板题.cpp ├── 1292.cpp ├── 1293 连加.cpp ├── 1293.cpp ├── 1294.cpp ├── 1294_2.cpp ├── 1294_3.cpp ├── 1295 最大乘积.cpp ├── 1295.cpp ├── 1296.cpp ├── 1297.cpp ├── 1298.cpp ├── 1300.cpp ├── 1301.cpp ├── 1302.cpp ├── 1303.cpp ├── 1303_2.cpp ├── 1303_3.cpp ├── 1305.cpp ├── 1305_2.cpp ├── 1305_3.cpp ├── 1306.cpp ├── 1307.cpp ├── 1308.cpp ├── 1308_2.cpp ├── 1308_3.cpp ├── 1309.cpp ├── 1309_2.cpp ├── 1310.cpp ├── 1330.cpp ├── 1331.cpp ├── 1331_12.cpp ├── 1332.cpp ├── 1332_12.cpp ├── 1332_13.cpp ├── 1332_2.cpp ├── 1333.cpp ├── 1335.cpp ├── 1336.cpp ├── 1336_12.cpp ├── 1336_23.cpp ├── 1338.cpp ├── 1400.cpp ├── 1401.cpp ├── 1402.cpp ├── 1402_2.cpp ├── 1402_3.cpp ├── 1402_4.cpp ├── 1402_5.cpp ├── 1402_6.cpp ├── 1402_7.cpp ├── 1403.cpp ├── 1404.cpp ├── 1405.cpp ├── 1405_12.cpp ├── 1405_23.cpp ├── 1406.cpp ├── 1408.cpp ├── 1410.cpp ├── 1411.cpp ├── 1412 计算表达式的值.cpp ├── 1412.cpp ├── 1412_12.cpp ├── 1412_13.cpp ├── 1412_2.cpp ├── 1412_3.cpp ├── 1412_4.cpp ├── 1413.cpp ├── 1413_12.cpp ├── 1413_2.cpp ├── 1413_23.cpp ├── 1413_24.cpp ├── 1413_25.cpp ├── 1413_26.cpp ├── 1413_27.cpp ├── 1413_34.cpp ├── 1413_45.cpp ├── 1414.cpp ├── 1414_2.cpp ├── 1415.cpp ├── 1416.cpp ├── 1417.cpp ├── 1418.cpp ├── 1419.cpp ├── 1419_2.cpp ├── 1420_2.cpp ├── 1421.cpp ├── 1421_12.cpp ├── 1421_2.cpp ├── 1422.cpp ├── 1422_2.cpp ├── 1424.cpp ├── 1425.cpp ├── 1426.cpp ├── 1426_2.cpp ├── 1427.cpp ├── 1429.cpp ├── 1429_12.cpp ├── 1430.cpp ├── 1430_12.cpp ├── 1430_2.cpp ├── 1431.cpp ├── 1431_12.cpp ├── 1431_23.cpp ├── 1431_24.cpp ├── 1431_35.cpp ├── 1431_46.cpp ├── 1431_47.cpp ├── 1440 图灵机游戏.cpp ├── 1493 在线最小值问题.cpp ├── 1494.cpp ├── 1507 简单问题.cpp ├── 1508 【代码能力提升套题3】中秋博饼.cpp ├── 1509 【代码能力提升套题3】波浪数.cpp ├── 1510 【代码能力提升套题3】幻方.cpp ├── 1510【代码能力提升套题3】幻方.xlsx ├── 1511 【代码能力提升套题3】表达式的转换.cpp ├── 1517 【代码能力提升套题 5】费波那契数列求和.cpp ├── 1600.cpp ├── 1600_12.cpp ├── 1601.cpp ├── 1601_12.cpp ├── 1601_2.cpp ├── 1602.cpp ├── 1602_12.cpp ├── 1602_23.cpp ├── 1603.cpp ├── 1604.cpp ├── 1605.cpp ├── 1606.cpp ├── 1606_12.cpp ├── 1606_23.cpp ├── 1607.cpp ├── 1608.cpp ├── 1609.cpp ├── 1610.cpp ├── 1610_23.cpp ├── 1611 多个公司间的机器分配问题.cpp ├── 1611.cpp ├── 1611_12.cpp ├── 1611_23.cpp ├── 1611_34.cpp ├── 1611_45.cpp ├── 1613 生物基元问题.cpp ├── 1614 双塔.cpp ├── 1615 加分二叉树.cpp ├── 1616 乘积最大.cpp ├── 1617 数字游戏【动态规划 DP专题训练】.cpp ├── 1618.cpp ├── 1618_12.cpp ├── 1620 石子合并.cpp ├── 1621 1的最优操作序列 - 2.cpp ├── 1621 1的最优操作序列.cpp ├── 1623 街道路径条数.cpp ├── 1624 过河卒.cpp ├── 1625 统计正方形和长方形个数.cpp ├── 1627 方格取数.cpp ├── 1629 花店橱窗布置问题.cpp ├── 1630 宝石.cpp ├── 1631 拦截导弹.cpp ├── 1632 合唱队形.cpp ├── 1633 渡河.cpp ├── 1634 最长公共子序列:勇闯黄金十二宫.cpp ├── 1635 Tom的烦恼.cpp ├── 1636 Pascal山脉.cpp ├── 1637 光荣的梦想.cpp ├── 1640 能量项链.cpp ├── 1641 金明的预算方案.cpp ├── 1642 过河.cpp ├── 1643 小钻石合并.cpp ├── 1647 邮局.cpp ├── 1652 Eating High.cpp ├── 1656 货币系统.cpp ├── 1657 竞赛总分.cpp ├── 1658 质数和分解.cpp ├── 1659 最小乘车费用.cpp ├── 1660 拔河比赛.cpp ├── 1673 学习技能.cpp ├── 1701 [USACO 1.1.2]贪婪的礼物送礼者.cpp ├── 1702 [USACO 1.1.3]黑色星期五.cpp ├── 1703.cpp ├── 1704.cpp ├── 1705.cpp ├── 1707.cpp ├── 1708.cpp ├── 1709.cpp ├── 1710 [USACO 1.3.2]修理牛.cpp ├── 1715.cpp ├── 1717.cpp ├── 1718.cpp ├── 1718_2.cpp ├── 1718_3.cpp ├── 1719.cpp ├── 1719_2.cpp ├── 1720 [USACO 1.5.4]跳棋的挑战.cpp ├── 1724.cpp ├── 1724_2.cpp ├── 1724_3.cpp ├── 1725.cpp ├── 1727.cpp ├── 1729.cpp ├── 1733.cpp ├── 1733_2.cpp ├── 1736 [USACO 2.4.2]穿越栅栏.cpp ├── 1738 [USACO 2.4.4]回家.cpp ├── 1739 [USACO 2.4.5]分数化小数.cpp ├── 1740 [USACO 3.1.1]最短网络.cpp ├── 1741 [USACO 3.1.2]总分.cpp ├── 1746 [USACO 3.2.1]阶乘.cpp ├── 1787 [USACO 5.4.2]周游加拿大.cpp ├── 1787周游加拿大.cpp ├── 1800 NOIP2009 多项式输出.cpp ├── 1801 【NOIP2009 普及组】分数线划定.cpp ├── 1804 【NOIP2010 普及组】数字统计.cpp ├── 1805 【NOIP2010 普及组】接水问题.cpp ├── 1806 NOIP2010 导弹拦截.cpp ├── 1808 【NOIP2011 普及组】数字反转.cpp ├── 1809 【NOIP2011 普及组】统计单词数.cpp ├── 1812 【NOIP2012 普及组】质因数分解.cpp ├── 1816 【NOIP2013 普及组】计数问题.cpp ├── 1817 【NOIP2013 普及组】表达式求值.cpp ├── 1820 【NOIP2014 普及组】珠心算测验.cpp ├── 1821 【NOIP2014 普及组】比例简化.cpp ├── 1824 【NOIP2015 普及组】金币.cpp ├── 1825 【NOIP2015 普及组】扫雷游戏.cpp ├── 1826 【NOIP2015 普及组】求和.cpp ├── 1828 【NOIP2016 普及组】买铅笔.cpp ├── 1831 【NOIP2016 普及组】魔法阵.cpp ├── 1832 【NOIP2008 普及组】ISBN号码.cpp ├── 1833 【NOIP2008 普及组】排座椅.cpp ├── 1835 【NOIP2008 普及组】立体图.cpp ├── 1836 【NOIP2007 普及组】奖学金.cpp ├── 1837 【NOIP2007 普及组】纪念品分组.cpp ├── 1840 【NOIP2006 普及组】明明的随机数.cpp ├── 1841 【NOIP2006 普及组】开心的金明.cpp ├── 1844 【NOIP2005 普及组】陶陶摘苹果.cpp ├── 1845 【NOIP2005 普及组】校门外的树.cpp ├── 1846 【NOIP2005 普及组】采药.cpp ├── 1848 【NOIP2004 普及组】不高兴的津津.cpp ├── 1850 【NOIP2004 普及组】FBI树.cpp ├── 1854 【NOIP2003 普及组】栈.cpp ├── 1855 【NOIP2003 普及组】麦森数.cpp ├── 1860 【2013年宁波赛】朋友.cpp ├── 1861 【2013年宁波赛】分数统计.cpp ├── 1862 【2013年宁波赛】跳棋.cpp ├── 1863 【NOIP2001 普及组】装箱问题.cpp ├── 1900 【NOIP模拟赛A01】升级计数.cpp ├── 1901.cpp ├── 1901_101.cpp ├── 1902.cpp ├── 1902_101.cpp ├── 1902_2.cpp ├── 1902_3.cpp ├── 1902_4.cpp ├── 1902_5.cpp ├── 1903.cpp ├── 1903_2.cpp ├── 1920 【NOIP模拟赛A06】检查员.cpp ├── 1921 【NOIP模拟赛A06】奶牛.cpp ├── 1922 【NOIP模拟赛A06】跳房子.cpp ├── 1923 【NOIP模拟赛A06】足球比赛.cpp ├── 1924 【NOIP模拟赛A07】FJ的字母矩阵.cpp ├── 1927 【NOIP模拟赛A07】回文路径.cpp ├── 1940 【NOIP模拟赛A11】Reordering the Cows.cpp ├── 1942 【NOIP模拟赛A11】Cow Art.cpp ├── 1943 【NOIP模拟赛A11】mooomoo.cpp ├── 1944 【NOIP模拟赛A12】马拉松.cpp ├── 1945 【NOIP模拟赛A12】Odometer.cpp ├── 1947 【NOIP模拟赛A12】GPS事故.cpp ├── 1952 【2015宁波赛】羊羊整除.cpp ├── 1953 【2015宁波赛】羊羊吃草.cpp ├── 1954 【2015宁波赛】羊羊修路.cpp ├── 1955 【2015宁波赛】羊羊列队.cpp ├── 1956.cpp ├── 1957.cpp ├── 1958.cpp ├── 1959.cpp ├── 1960 【NOIP模拟赛0917】地理.cpp ├── 1961 【NOIP模拟赛0917】开心农场.cpp ├── 1962 【NOIP模拟赛0917】敌区冒险.cpp ├── 1963 【NOIP模拟赛0917】郁闷的记者.cpp ├── 1963 【NOIP模拟赛180320】奔跑吧奶牛.cpp ├── 1964 【NOIP模拟赛1007】公交线.cpp ├── 1965 【NOIP模拟赛1007】游荡的奶牛.cpp ├── 1966 【NOIP模拟赛1007】蚂蚁移动.cpp ├── 1967 【NOIP模拟赛1007】bales.cpp ├── 1968 【NOIP模拟赛1015】整点报时.cpp ├── 1969 【NOIP模拟赛1015】求和问题.cpp ├── 1970 【NOIP模拟赛1015】整除问题.cpp ├── 1971 【NOIP模拟赛1015】这是一道动规题.cpp ├── 1972 【2014宁波赛】战马列队.cpp ├── 1974 【2014宁波赛】马语翻译.cpp ├── 1990 【2010宁波赛】插入排序.cpp ├── 1992 【NOIP模拟赛1105】Led.cpp ├── 1993 【NOIP模拟赛1105】Bcl.cpp ├── 1994 【NOIP模拟赛1105】Ovce.cpp ├── 1995 【NOIP模拟赛1105】Paint.cpp ├── 2000 奉化-1001 反序(一).cpp ├── 2001 奉化-1002 反序(二).cpp ├── 2002 奉化-1003 求平均数(一).cpp ├── 2003 奉化-1004 商和余数.cpp ├── 2004 奉化-1005 圆的面积.cpp ├── 2005 奉化-1006 三角形的周长与面积.cpp ├── 2006 奉化-1007 反序(三).cpp ├── 2007 奉化-1008 排序(一).cpp ├── 2008 奉化-1009 输出最小数.cpp ├── 2009 奉化-1010 计算星期几.cpp ├── 2010 奉化-1011 某月有几天.cpp ├── 2011 奉化-1012 简单计算器.cpp ├── 2012 奉化-1013 求平均数(二).cpp ├── 2013 奉化-1014 求平均数(三).cpp ├── 2014 奉化-1015 计算n!.cpp ├── 2015 奉化-1016 输出字母串.cpp ├── 2016 奉化-1017 菲波拉契数列.cpp ├── 2017 奉化-1018 输出最大值.cpp ├── 2018 奉化-1019 求总和.cpp ├── 2019 奉化-1020 统计(一).cpp ├── 2020 奉化-1021 守形数.cpp ├── 2021 奉化-1022 最大公约数.cpp ├── 2022 奉化-1023 最小公倍数.cpp ├── 2023 奉化-1024 倒顺数字串.cpp ├── 2024 奉化-1025 数字金字塔.cpp ├── 2025 奉化-1026 空心的字母金字塔.cpp ├── 2027 奉化-1028 上三角数字三角形(二).cpp ├── 2028 奉化-1029 平方和.cpp ├── 2029 奉化-1030 上楼梯的方法数.cpp ├── 2030 奉化-1031 超越.cpp ├── 2031 奉化-1032 组成最小整数.cpp ├── 2032 奉化-1033 组成最大整数.cpp ├── 2033 奉化-1034 从小到大排序.cpp ├── 2034 奉化-1035 从大到小排序.cpp ├── 2035 奉化-1036 偶数之和.cpp ├── 2036 奉化-1037 奇偶数之差.cpp ├── 2037 奉化-1038 完数.cpp ├── 2038 奉化-1039 亲和数.cpp ├── 2039 奉化-1040 三角形问题.cpp ├── 2040 奉化-1041 十进制正整数化为二进制正整数.cpp ├── 2041 奉化-1042 最大的正整数.cpp ├── 2042 奉化-1043 正整数加法.cpp ├── 2085 多源最短路.cpp ├── 2088 基数排序.cpp ├── ngjkvdnfjgksdfg.cpp └── 资料 ├── P1405 - 2017.4.12 ├── 2017-4-12 19-25-29.JPG ├── 2017-4-12 19-25-31.JPG ├── 2017-4-12 19-25-37.JPG ├── 2017-4-12 19-31-31.JPG ├── 2017-4-12 19-36-8.JPG ├── 2017-4-12 19-39-59.JPG ├── 2017-4-12 19-42-5.JPG ├── 2017-4-12 19-45-42.JPG └── ans │ ├── 2017-4-12 19-57-19.JPG │ └── 2017-4-12 19-57-36.JPG ├── P1413 - 2017.5.3 ├── 2017-5-7 14-39-28.JPG ├── 2017-5-7 14-42-52.JPG ├── 2017-5-7 14-44-12.JPG ├── 2017-5-7 14-44-25.JPG ├── 2017-5-7 14-45-59.JPG ├── 2017-5-7 14-48-4.JPG ├── 2017-5-7 14-50-20.JPG ├── 2017-5-7 14-55-58.JPG ├── 2017-5-7 14-56-42.JPG └── 2017-5-7 14-57-24.JPG ├── P1903 - 2017.3.1 ├── P1903 (1).JPG ├── P1903 (2).JPG ├── P1903 (3).JPG ├── P1903 (4).JPG ├── P1903 (5).JPG ├── P1903 (6).JPG ├── P1903 (7).JPG ├── P1903 (8).JPG └── P1903 (9).JPG └── 高精度 - 2017.3.19 ├── 2017-3-19 13-35-26.JPG ├── 2017-3-19 13-45-14.JPG └── 2017-3-19 14-37-45.JPG /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.in 3 | *.out 4 | *.txt 5 | *.bat 6 | *.ini 7 | INPUT 8 | OUTPUT 9 | private/* 10 | *.sublime-workspace 11 | .vscode 12 | .vscode/* 13 | OI-Code.dev 14 | OI-Code.layout 15 | 16 | newFile.app/* 17 | .DS_Store 18 | -------------------------------------------------------------------------------- /BZOJ/1000 A+B Problem.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/BZOJ/1000 A+B Problem.cpp -------------------------------------------------------------------------------- /BZOJ/1331 魔板.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/BZOJ/1331 魔板.cpp -------------------------------------------------------------------------------- /BZOJ/2456 mode.cpp: -------------------------------------------------------------------------------- 1 | // ============================== 2 | // author: memset0 3 | // website: https://memset0.cn 4 | // ============================== 5 | #include 6 | 7 | int n, x, i, now, cnt = 1; 8 | 9 | int main() { 10 | 11 | scanf("%d%d", &n, &now); 12 | for (i = 2; i <= n; i++) { 13 | // printf("%d %d\n", now, cnt); 14 | scanf("%d", &x); 15 | cnt += x == now ? 1 : -1; 16 | if (!cnt) now = x, cnt = 1; 17 | } 18 | printf("%d\n", now); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /BZOJ/2962 序列操作.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/BZOJ/2962 序列操作.cpp -------------------------------------------------------------------------------- /CodeForces Gym/101981A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int n, k; 6 | scanf("%d%d", &n, &k); 7 | if (n == 0 || (k == 1 && (n & 1) == 0)) 8 | puts("Austin"); 9 | else 10 | puts("Adrien"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CodeForces Gym/101981K.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | for (int i = 0; i < 50000; i++) 6 | switch (rand() % 4) { 7 | case 0: putchar('U'); break; 8 | case 1: putchar('L'); break; 9 | case 2: putchar('R'); break; 10 | case 3: putchar('D'); break; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /CodeForces/Codeforces Round #486 (Div. 3)/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const int maxn = 110; 4 | int n, m, a[maxn], b[maxn], c[maxn]; 5 | 6 | int main() { 7 | 8 | scanf("%d%d", &n, &m); 9 | for (int i = 1; i <= n; i++) 10 | scanf("%d", &a[i]); 11 | 12 | int cnt = 0; 13 | for (int i = 1; i <= n; i++) 14 | if (!b[a[i]]) { 15 | c[++cnt] = i; 16 | b[a[i]] = 1; 17 | } 18 | 19 | if (cnt >= m) { 20 | printf("YES\n"); 21 | for (int i = 1; i <= m; i++) 22 | printf("%d ", c[i]); 23 | } else { 24 | printf("NO"); 25 | } 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /CodeForces/Codeforces Round #486 (Div. 3)/F.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define isnum(x) ('0' <= x && x <= '9') 3 | #define read(x) do { \ 4 | x = 0, r::c = std::getchar(), r::m = 1; \ 5 | while (!isnum(r::c) && r::c != '-') r::c = getchar(); \ 6 | if (r::c == '-') r::m = -1, r::c = getchar(); \ 7 | while (isnum(r::c)) x = x * 10 + r::c - '0', r::c = getchar(); \ 8 | x *= r::m; \ 9 | } while(0) 10 | using namespace std; 11 | namespace r { 12 | char c; 13 | int m; 14 | } 15 | 16 | int main() { 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /CodeForces/Codeforces Round #486 (Div. 3)/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | struct Node { 4 | int a; 5 | }; 6 | int main() { 7 | map < int, Node > m; 8 | m[1] = {1}; 9 | cout << m[1].a << " " << m[2].a; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /CodeForces/README.md: -------------------------------------------------------------------------------- 1 | memset0 菜菜 CodeForces 极少打。 2 | 3 | 另外 CodeForces 上我的号是 `memset0_China` 而不是 `memset0` 。 4 | -------------------------------------------------------------------------------- /CodeVS/P1201.cpp: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | using namespace std; 4 | int main() 5 | { 6 | int n, temp; 7 | cin >> n >> temp; 8 | int min = temp, max = temp; 9 | for (int i = 2; i <= n; i ++) 10 | { 11 | cin >> temp; 12 | if (temp > max) max = temp; 13 | if (temp < min) min = temp; 14 | } 15 | cout << min << " " << max; 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /CodeVS/P1202.cpp: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | using namespace std; 4 | int main() 5 | { 6 | int n, s = 0, temp; 7 | cin >> n; 8 | for (int i = 1; i <= n; i ++) 9 | { 10 | cin >> temp; 11 | s += temp; 12 | } 13 | cout << s; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /CodeVS/P1203.cpp: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | # include 4 | using namespace std; 5 | int main() 6 | { 7 | double a,b; 8 | cin >> a >> b; 9 | if (abs(a - b) <= 0.00000001) cout << "yes"; 10 | else cout << "no"; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CodeVS/P1204.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | string a,b; 9 | int i,j; 10 | int flag = 0; 11 | cin >> a >> b; 12 | for(i = 0, j = 0; b[j]!= '\0';){ 13 | if(a[i]==b[j]){ 14 | i++; 15 | j++; 16 | } 17 | else{ 18 | flag++; 19 | j=0; 20 | i=flag; 21 | } 22 | } 23 | cout << flag + 1; 24 | } 25 | -------------------------------------------------------------------------------- /CodeVS/P1206.cpp: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | using namespace std; 4 | int main() 5 | { 6 | double s; 7 | cin >> s; 8 | printf("%.2lf", s); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /CodeVS/P2235.cpp: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | using namespace std; 4 | int main() 5 | { 6 | int i, s; 7 | float f, temps; 8 | cin >> i >> f; 9 | temps = i * f / 100.0; 10 | if ((temps-(int)temps) < 0.5) s = s; 11 | else temps = temps + 1; 12 | s = (int)temps * 10; 13 | cout << s; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /FLOJ/contest449/rebuild.sh: -------------------------------------------------------------------------------- 1 | mkdir tmp 2 | cp 1.cpp tmp/1.cpp 3 | cp 2.cpp tmp/2.cpp 4 | cp 3.cpp tmp/3.cpp 5 | cp ../mod.cpp 1.cpp 6 | cp ../mod.cpp 2.cpp 7 | cp ../mod.cpp 3.cpp 8 | -------------------------------------------------------------------------------- /FLOJ/contest457/rebuild.sh: -------------------------------------------------------------------------------- 1 | mkdir tmp 2 | cp 1.cpp tmp/1.cpp 3 | cp 2.cpp tmp/2.cpp 4 | cp 3.cpp tmp/3.cpp 5 | cp ../mod.cpp 1.cpp 6 | cp ../mod.cpp 2.cpp 7 | cp ../mod.cpp 3.cpp 8 | -------------------------------------------------------------------------------- /LJOJ/1004 暗夜精灵.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 3010, maxm = 130; 4 | int n, k, a[maxn], f[maxn][maxn]; 5 | int main() { 6 | n = read(); 7 | for (int i = 1; i <= n; i++) 8 | 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /LJOJ/1244 埃及分数(1).cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/1244 埃及分数(1).cpp -------------------------------------------------------------------------------- /LJOJ/2157 [SDOI2009] 学校食堂.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/2157 [SDOI2009] 学校食堂.cpp -------------------------------------------------------------------------------- /LJOJ/3851 渴.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/3851 渴.cpp -------------------------------------------------------------------------------- /LJOJ/4957 量子谜题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int x, y, z, n, m, f[151][151]; 3 | int main() { 4 | std::scanf("%d%d%d%d%d", &x, &y, &z, &n, &m), m++; 5 | for (int i = 0; i <= m; i++) f[i][0] = 1; 6 | for (int i = 1; i <= m; i++) 7 | for (int j = 0; j <= n; j++) 8 | for (int k = 0; k <= j - 1; k++) 9 | f[i][j] = (f[i][j] + f[i - 1][k] * f[i - 1][j - 1 - k]) % 2016; 10 | std::printf("%d\n", (f[m][n] - f[m - 1][n] + 2016) % 2016); 11 | } 12 | -------------------------------------------------------------------------------- /LJOJ/4961 plutotree.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/4961 plutotree.cpp -------------------------------------------------------------------------------- /LJOJ/5030 选球游戏.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/5030 选球游戏.cpp -------------------------------------------------------------------------------- /LJOJ/5039 志愿者.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/5039 志愿者.cpp -------------------------------------------------------------------------------- /LJOJ/5107 merchant.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/5107 merchant.cpp -------------------------------------------------------------------------------- /LJOJ/对拍/3851 渴/100.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/对拍/3851 渴/100.cpp -------------------------------------------------------------------------------- /LJOJ/对拍/3852 三角形计数/data.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() { 5 | srand(GetTickCount()); 6 | int n = 3, m = 4, a[n][n]; 7 | printf("%d\n", n); 8 | for (int i = 1; i <= n; i++) { 9 | int x = rand() % m, y = rand() % m; 10 | while (a[x][y]) x = rand() % m, y = rand() % m; 11 | a[x][y] = 1; 12 | printf("%d %d\n", x, y); 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /LJOJ/对拍/3853 ZCC loves Isaac/data.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int n=4; 6 | 7 | inline int brand(){ 8 | return (rand()<<16)+(rand()<<1)+(rand()&1); 9 | } 10 | 11 | int main(){ 12 | // freopen("isaac.in","w",stdout); 13 | srand(GetTickCount()); 14 | printf("%d\n",n); 15 | for (int i=1;i<=n;i++) printf("%d\n",brand()%n+1); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /LJOJ/对拍/4657 区间/3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int n, k, p, A, B, C, D; 6 | 7 | int r() { 8 | return ((rand()<<16)+(rand()<<1)+(rand()&1)) % 10; 9 | } 10 | 11 | int main() { 12 | srand(GetTickCount()); 13 | 14 | n = r() % 200000 + 1; 15 | k = r() % (n - 1) + 2; 16 | p = r(); 17 | A = r(); 18 | B = r(); 19 | C = r(); 20 | D = r(); 21 | printf("%d %d %d\n%d %d %d %d\n", n, k, p, A, B, C, D); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /LJOJ/对拍/4957 量子谜题/3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int r(int t) { 4 | return (rand() % t) + 1; 5 | } 6 | int main() { 7 | srand(time(0)); 8 | int l = 10; 9 | int n = r(l), m = r(l); 10 | while (n > m + 1) n = r(l), m = r(l); 11 | printf("1 2 3 %d %d\n", n, m); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /LJOJ/对拍/4975 保护数列/data.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int r(int n) { return rand() % n + 1; } 5 | int main() { 6 | srand(GetTickCount()); 7 | int n = 10000; 8 | printf("%d\n", n); 9 | for (int i = 1; i <= n; i++) 10 | printf("%d ", r(n)); 11 | puts(""); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /LJOJ/对拍/4975 保护数列/tempCodeRunnerFile.cpp: -------------------------------------------------------------------------------- 1 | iterator it = q.begin(); it != q.end(); it++) 2 | // printf(">>> %d %d % -------------------------------------------------------------------------------- /LJOJ/对拍/4976 树上行走/tempCodeRunnerFile.cpp: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /LJOJ/考试/20181208 - NOI模拟1/Problems.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/考试/20181208 - NOI模拟1/Problems.pdf -------------------------------------------------------------------------------- /LJOJ/考试/20181208 - NOI模拟1/Solution.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/考试/20181208 - NOI模拟1/Solution.pptx -------------------------------------------------------------------------------- /LJOJ/考试/20181210 - NOI模拟2/1210SOL.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/考试/20181210 - NOI模拟2/1210SOL.ppt -------------------------------------------------------------------------------- /LJOJ/考试/20181211 - NOI模拟3/1211sol.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/LJOJ/考试/20181211 - NOI模拟3/1211sol.pptx -------------------------------------------------------------------------------- /LOJ/1 A + B Problem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a, b; 4 | int main() { 5 | cin >> a >> b; 6 | cout << a + b; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /LOJ/2 Hello, World!.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){std::cout<<"Hello, World!";} 3 | -------------------------------------------------------------------------------- /LOJ/2822 组合数问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define ll long long 3 | using namespace std; 4 | 5 | int read() { 6 | int x = 0; bool m = 0; char c = getchar(); 7 | while (!isdigit(c) && c != '-') c = getchar(); 8 | if (c == '-') m = 1, c = getchar(); 9 | while (isdigit(c)) x = x * 10 + c - '0', c = getchar(); 10 | if (m) return -x; else return x; 11 | } 12 | 13 | int t, k, n, m; 14 | 15 | int main() { 16 | 17 | 18 | 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /LOJ/3 Copycat.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n; 4 | string s; 5 | int main() { 6 | freopen("copycat.in", "r", stdin); 7 | freopen("copycat.out", "w", stdout); 8 | cin >> n; 9 | while (n--) { 10 | cin >> s; 11 | cout << s << endl; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LOJ/6 Guess Number.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "interaction.h" 3 | using namespace std; 4 | int n, l, r, mid, ret; 5 | vector < int > ans; 6 | int main() { 7 | n = get_num(); 8 | for(int i = 0; i < n; i++) { 9 | l = 1, r = 1000000; 10 | while(l <= r) { 11 | mid = (l + r) >> 1; 12 | ret = guess(i,mid); 13 | if(!ret) break; 14 | if(ret == 1) r = mid - 1; 15 | else l = mid + 1; 16 | } 17 | ans.push_back(mid); 18 | } 19 | submit(ans); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /LOJ/6277 数列分块入门 1 - DATA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define r(lim) (rand() % lim + 1) 3 | using namespace std; 4 | int main() { 5 | srand(time(0)); 6 | int n = 6, lim = 10; 7 | printf("%d\n", n); 8 | for (int i = 1; i <= n; i++) 9 | printf("%d ", r(lim)); 10 | puts(""); 11 | for (int i = 1; i <= n; i++) 12 | printf("%d %d %d %d\n", rand() % 2, r(n), r(n), r(lim)); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /LOJ/7 Input Test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define ll long long 3 | using namespace std; 4 | ll read() { 5 | ll x = 0; bool m = 0; char c = getchar(); 6 | while (!isdigit(c) && c != '-') c = getchar(); 7 | if (c == '-') m = 1, c = getchar(); 8 | while (isdigit(c)) x = x * 10 + c - '0', c = getchar(); 9 | if (m) return -x; else return x; 10 | } 11 | int main() { 12 | ll ans = 0; 13 | for (int i = 1; i <= 3e6; i++) 14 | ans ^= read(); 15 | printf("%lld\n", ans); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /New: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/New -------------------------------------------------------------------------------- /NowCoder/contest334/a.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | printf("Helle World!\n"); 4 | } 5 | -------------------------------------------------------------------------------- /NowCoder/contest334/j.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | const int MOD=100000007; 3 | 4 | int n,f[10005]; 5 | 6 | int main(){ 7 | f[0]=1; 8 | for (int i=1;i<=10000;++i){ 9 | f[i]=f[i-1]; 10 | for (int j=2;j<=i;j+=2){ 11 | f[i]+=f[i-j]; 12 | f[i]%=MOD; 13 | } 14 | } 15 | while (scanf("%d",&n)!=EOF) printf("%d\n",f[n]); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # memset0 的 OI 代码 2 | 3 | memset0 的 OI 菜菜滴呢...天天被各大佬吊打呜呜呜。 4 | 5 | 平时做题的时候啥都不会,只能靠刷刷水题勉强维持生活的这样子。 6 | -------------------------------------------------------------------------------- /Rubbish/1 (2).cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/Rubbish/1 (2).cpp -------------------------------------------------------------------------------- /Rubbish/1 (3).cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/Rubbish/1 (3).cpp -------------------------------------------------------------------------------- /Rubbish/1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int n = 100000000; 4 | int tot = 0; 5 | int flag[n + 1], prime[n + 1]; 6 | int main() { 7 | for (int i = 2; i <= n; i++) { 8 | if (!flag[i]) { 9 | prime[++tot] = i; 10 | } 11 | for (int j = 1; i * prime[j] <= n; j++) { 12 | flag[i * prime[j]] = 1; 13 | if (i % prime[j] == 0) break; 14 | } 15 | } 16 | cout << tot << endl; 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Rubbish/2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int read 4 | int main() { 5 | int a, b; 6 | cin >> a >> b; 7 | cout << a + b << endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /Rubbish/2026 奉化-1027 上三角数字三角形(一).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, cnt = 0; 4 | int main() { 5 | cin >> n; 6 | for (int i = 1; i <= n; i++) { 7 | for (int j = 1; j <= n + 1 - i; j++) 8 | printf("%4d", ++cnt); 9 | puts(""); 10 | } 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Rubbish/2724 联系 Contact.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/Rubbish/2724 联系 Contact.cpp -------------------------------------------------------------------------------- /Rubbish/3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int a, b; 5 | cin >> a >> b; 6 | cout << a + b << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /Rubbish/demo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int read(void); 4 | 5 | int main() { 6 | freopen("filename.in", "r", stdin); 7 | freopen("filename.out", "w", stdout); 8 | 9 | return 0; 10 | } 11 | 12 | int ret; char chr; bool mrk; 13 | int read() { 14 | chr = getchar(), ret = mrk = 0; 15 | while (!('0' <= chr && chr <= '9') && chr != '-') chr = getchar(); 16 | if (chr == '-') mrk = 1, chr = getchar(); 17 | while ('0' <= chr && chr <= '9') ret = ret * 10 + chr - '0', chr = getchar(); 18 | if (mrk) return -ret; else return ret; 19 | } 20 | -------------------------------------------------------------------------------- /Rubbish/splay.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/Rubbish/splay.cpp -------------------------------------------------------------------------------- /Rubbish/temp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | struct num { 4 | int a = 1, b = 2; 5 | int& operator [] (int k) { 6 | if (k == 1) return a; 7 | else return b; 8 | } 9 | } x, y; 10 | num operator + (num &a, num &b) { 11 | num x; 12 | x.a = a.a + b.a; 13 | x.b = a.b + b.b; 14 | return x; 15 | } 16 | int main() { 17 | int a = 10, b = 20; 18 | cout << a + b << endl; 19 | num t = x + y; 20 | cout << t.a << " " << t.b << endl; 21 | cout << t[1] << " " << t[2] << endl; 22 | } 23 | -------------------------------------------------------------------------------- /Rubbish/temp001.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1000; 4 | int main() { 5 | __int128 a; 6 | cin >> a; 7 | cout << a; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /Rubbish/temp0025.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | cout << (1 < 2 ? 0 : 1); 5 | } 6 | -------------------------------------------------------------------------------- /洛谷/AT1402 N重丸.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, R[1010]; 4 | const double PI=acos(-1.0); 5 | double sum=0.0; 6 | int main() { 7 | scanf("%d", &n); 8 | for(int i=1;i<=n;i++) 9 | scanf("%d", &R[i]); 10 | sort(R+1,R+n+1); 11 | for(int i=0;i<=n;i+=2) 12 | sum-=R[i]*R[i]; 13 | for(int i=1;i<=n;i+=2) 14 | sum+=R[i]*R[i]; 15 | sum*=PI; 16 | printf("%.10lf\n",abs(sum)); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/AT1481 カキ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | char a[101]; 5 | int s=0; 6 | for(int i=0;i<12;i++) { 7 | scanf("%s",a); 8 | if(strstr(a,"r")) s++; 9 | } 10 | printf("%d\n",s); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /洛谷/AT211 大好き高橋君.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, ans; 4 | string s; 5 | int main() { 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) { 8 | cin >> s; 9 | if (s == "TAKAHASHIKUN") ans++; 10 | else if (s == "Takahashikun") ans++; 11 | else if (s == "takahashikun") ans++; 12 | else if (s == "TAKAHASHIKUN.") ans++; 13 | else if (s == "Takahashikun.") ans++; 14 | else if (s == "takahashikun.") ans++; 15 | } 16 | cout << ans << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/AT2351 Yahoo【过水已隐藏】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | string s; 4 | int y, a, h, o; 5 | int main() { 6 | cin >> s; 7 | for (int i = 0; i < s.length(); i++) 8 | if (s[i] == 'y') y++; 9 | else if (s[i] == 'a') a++; 10 | else if (s[i] == 'h') h++; 11 | else if (s[i] == 'o') o++; 12 | if (y && a && h && o == 2) cout << "YES" << endl; 13 | else cout << "NO" << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /洛谷/AT3529 Theater.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010, maxm = 100010; 4 | int n, ans, m = 100000, l, r, f[maxm]; 5 | int main() { 6 | scanf("%d", &n); 7 | for (int i = 1; i <= n; i++) { 8 | scanf("%d%d", &l, &r); 9 | for (int j = l; j <= r; j++) 10 | f[j] = 1; 11 | } 12 | for (int i = 1; i <= m; i++) 13 | if (f[i]) ans++; 14 | printf("%d\n", ans); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/AT3572 XXFESTIVAL【过水已隐藏】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | string a; 4 | int main(){ 5 | cin >> a; 6 | a.erase(a.length() - 8, a.length() - 1); 7 | cout << a << endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /洛谷/AT3599 Addition and Multiplication.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, k, ans = 1; 4 | int main() { 5 | cin >> n >> k; 6 | for (int i = 1; i <= n; i++) 7 | ans += min(ans, k); 8 | cout << ans << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /洛谷/AT3675 Lucas Number【过水已隐藏】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n; 4 | long long f[87]; 5 | int main() { 6 | f[0] = 2, f[1] = 1; 7 | for (int i = 2; i < 87; i++) 8 | f[i] = f[i - 1] + f[i - 2]; 9 | cin >> n; 10 | cout << f[n] << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /洛谷/AT3718 Shift only【过水已隐藏】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 210; 4 | int n, ans = 0, a[maxn]; 5 | bool mrk; 6 | int main() { 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) 9 | cin >> a[i]; 10 | while (1) { 11 | mrk = true; 12 | for (int i = 1; i <= n; i++) { 13 | if (a[i] % 2) { 14 | mrk = false; 15 | break; 16 | } 17 | a[i] /= 2; 18 | } 19 | if (mrk) ans++; 20 | else break; 21 | } 22 | cout << ans << endl; 23 | return 0; 24 | } -------------------------------------------------------------------------------- /洛谷/AT508 君が望むなら世界中全てのたこ焼きを赤と青に染め上げよう【过水已隐藏】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | puts(n & 1 ? "Red" : "Blue"); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/AT918 スワップ【过水被隐藏】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | string a, b; 5 | cin >> a >> b; 6 | cout << b << " " << a << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/CF1023A Single Wildcard Pattern Matching.cpp: -------------------------------------------------------------------------------- 1 | input() 2 | a = input() 3 | b = input() 4 | 5 | a = a.split('*') 6 | 7 | # print(a) 8 | # print([b[:len(a[0])], b[-len(a[1]):]]) 9 | 10 | 11 | if len(a) == 1: 12 | if a[0] == b: 13 | print('YES') 14 | else: 15 | print('NO') 16 | else: 17 | if len(b) < len(a[0]) + len(a[1]) \ 18 | or (a[0] != b[:len(a[0])] and len(a[0]) > 0) \ 19 | or (a[1] != b[-len(a[1]):] and len(a[1]) > 0): 20 | print('NO') 21 | else: 22 | print('YES') 23 | -------------------------------------------------------------------------------- /洛谷/CF1030A In Search of an Easy Problem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n, x; 5 | cin >> n; 6 | while (n--) { 7 | cin >> x; 8 | if (x) { 9 | puts("HARD"); 10 | return 0; 11 | } 12 | } 13 | puts("EASY"); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /洛谷/CF12A Super Agent.cpp: -------------------------------------------------------------------------------- 1 | s = input() + input() + input() 2 | for i in range(5): 3 | if s[i] != s[8 - i]: 4 | print('NO') 5 | exit() 6 | print('YES') -------------------------------------------------------------------------------- /洛谷/CF1A Theatre Square.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long a, n, m; 4 | int main() { 5 | cin >> n >> m >> a; 6 | cout << ((n + a - 1) / a) * ((m + a - 1) / a) << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/CF271A Beautiful Year.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | scanf("%d", &n); 6 | for(int i=n+1;;i++) { 7 | int j=i; 8 | int a=j%10; 9 | j=j/10; 10 | int b=j%10; 11 | j=j/10; 12 | int c=j%10; 13 | j=j/10; 14 | int d=j%10; 15 | if(a!=b&&b!=c&&c!=d&&b!=d&&a!=d&&a!=c) 16 | { 17 | printf("%d\n",i); 18 | return 0; 19 | } 20 | } 21 | return 0; 22 | } -------------------------------------------------------------------------------- /洛谷/CF27A Next Test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | vector vec; 4 | int main() { 5 | int n; 6 | scanf("%d", &n); 7 | for(int i=1;i<=n;i++) 8 | { 9 | int k; 10 | scanf("%d", &k); 11 | vec.push_back(k); 12 | } 13 | for(int i=1;true;i++) 14 | { 15 | if(count(vec.begin(),vec.end(),i)==0) 16 | {cout< 2 | char s[] = "01001010111001010"; 3 | int main() { 4 | int n; 5 | scanf("%d", &n); 6 | printf("%c\n", s[n]); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/CF409F 000001.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int ans[] = {0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1, 4 | 15,2,2,5,4,1,4,1,51,1,2,1,14,1,2,2,14,1,6,1,4,2,2, 5 | 1,52,2,5,1,5,1,15,2,13,2,2,1,13,1,2,4,267,1,4,1,5, 6 | 1,4,1,50,1,2,3,4,1,6,1,52,15,2,1,15,1,2,1,12,1,10, 7 | 1,4,2}; 8 | int main() { 9 | int n; 10 | cin >> n; 11 | cout << ans[n]; 12 | } -------------------------------------------------------------------------------- /洛谷/CF656A Da Vinci Powers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long a[36] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8092, 16184, 32368, 64736, 129472, 258944, 517888, 1035776, 2071552, 4143104, 8286208, 16572416, 33144832, 66289664, 132579328, 265158656, 530317312, 1060634624, 2121269248, 4242538496, 8485076992, 16970153984, 33940307968 }; //打表用,OEIS数列A221180 4 | int main(){ 5 | int n; 6 | cin >> n; 7 | cout << a[n] << endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /洛谷/CF697A Pineapple Incident.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int t,s,x; 5 | 6 | int main(){ 7 | scanf("%d%d%d", &t, &s, &x); 8 | if (x < t) { puts("NO"); return 0; } 9 | if ((!((x - t) % s) || !((x - t - 1) % s)) && x != t + 1) 10 | puts("YES"); 11 | else 12 | puts("NO"); 13 | return 0; 14 | } -------------------------------------------------------------------------------- /洛谷/CF859A Declined Finalists.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, a, maxa; 4 | int main() { 5 | scanf("%d",&n); 6 | while (n--) { 7 | scanf("%d",&a); 8 | maxa = max(maxa, a); 9 | } 10 | printf("%d", max(maxa - 25, 0)); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /洛谷/P1001 A+B Problem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int a,b,c; 6 | cin>>a>>b; 7 | c=a+b; 8 | cout< 2 | using namespace std; 3 | const int maxn = 30; 4 | int n; 5 | string a[maxn]; 6 | bool cmp(string a, string b) { 7 | return a + b > b + a; 8 | } 9 | int main() { 10 | cin >> n; 11 | for (int i = 1; i <= n; i++) 12 | cin >> a[i]; 13 | sort(a + 1, a + n + 1, cmp); 14 | for (int i = 1; i <= n; i++) 15 | cout << a[i]; 16 | cout << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/P1014 Cantor表.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n, m; 5 | cin >> n; 6 | for (m = 1; n > m; n -= m, m++); 7 | if (m % 2) printf("%d/%d\n", m + 1 - n, n); 8 | else printf("%d/%d\n", n, m + 1 - n); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /洛谷/P1028 数的计算.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n, f[1010] = {1}; 4 | long long cal(long long k) { 5 | if (f[k]) return f[k]; 6 | int sum = 0; 7 | for (int i = 0; i * 2 <= k; i++) 8 | sum += cal(i); 9 | return f[k] = sum; 10 | } 11 | int main() { 12 | cin >> n; 13 | cout << cal(n) << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /洛谷/P1029 最大公约数和最小公倍数问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int n, m, ans, t; 3 | int gcd(int x, int y) 4 | { 5 | if(x < y) t = x, x = y, y = t; 6 | return x % y == 0 ? y : gcd(y, x % y); 7 | } 8 | int main() 9 | { 10 | scanf("%d%d", &n, &m); 11 | for(int i = n; i <= m; i += n) 12 | if((m * n) % i == 0 && gcd(m * n / i, i) == n) 13 | ans ++; 14 | printf("%d", ans); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P1035 级数求和.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | double s = 0, k; 4 | int main() { 5 | cin >> k; 6 | int i = 1; 7 | while (s <= k) { 8 | s += 1.0 / i; 9 | i++; 10 | } 11 | cout << i - 1 << endl; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /洛谷/P1044 栈.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 20; 4 | int n; 5 | long ans = 0; 6 | void DFS(int i, int k) { 7 | if (i <= n) 8 | DFS(i + 1, k + 1); 9 | if (k > 0) 10 | DFS(i, k - 1); 11 | if (i > n && k <= 0) { 12 | ans++; 13 | return ; 14 | } 15 | } 16 | int main() { 17 | cin >> n; 18 | if (n == 18) ans = 477638700; 19 | else if (n == 17) ans = 129644790; 20 | else if (n == 16) ans = 35357670; 21 | else if (n == 15) ans = 9694845; 22 | else DFS(1, 0); 23 | cout << ans << endl; 24 | return 0; 25 | } -------------------------------------------------------------------------------- /洛谷/P1046 陶陶摘苹果.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int height[20],H,s; 4 | int main() 5 | { 6 | for(int i=0;i<10;i++)cin >> height[i]; 7 | cin >> H; 8 | H += 30; 9 | for(int i=0;i<10;i++)s+=!(H 2 | using namespace std; 3 | const int maxm = 10010; 4 | int n, m, l, r, a[maxm]; 5 | int main() { 6 | cin >> m >> n; 7 | for (int i = 1; i <= n; i++) { 8 | scanf("%d%d", &l, &r); 9 | for (int i = l; i <= r; i++) 10 | a[i] = 1; 11 | } 12 | int ans = 0; 13 | for (int i = 0; i <= m; i++) 14 | if (!a[i]) ans++; 15 | cout << ans << endl; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /洛谷/P1048 采药.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | const int maxm = 1010; 5 | int n, m, a[maxn], v[maxn], f[maxm]; 6 | int main() { 7 | cin >> m >> n; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d%d", &a[i], &v[i]); 10 | f[0] = 0; 11 | for (int i = 1; i <= n; i++) 12 | for (int j = m; j >= a[i]; j--) 13 | f[j] = max(f[j], f[j - a[i]] + v[i]); 14 | cout << f[m] << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P1049 装箱问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 40; 4 | const int maxm = 20010; 5 | int n, m, a[maxn], f[maxm]; 6 | int main() { 7 | cin >> m >> n; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | f[0] = 1; 11 | for (int i = 1; i <= n; i++) 12 | for (int j = m; j >= a[i]; j--) 13 | if (f[j - a[i]]) f[j] = 1; 14 | for (int i = m; i >= 0; i--) 15 | if (f[i]) { 16 | cout << m - i << endl; 17 | return 0; 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /洛谷/P1055 ISBN号码.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int f[9] = {0, 2, 3, 4, 6, 7, 8, 9, 10}; 4 | int main() { 5 | char a[100]; 6 | cin >> a; 7 | int sum = 0; 8 | for (int i = 0; i < 9; i++) 9 | sum += (a[f[i]] - '0') * (i + 1); 10 | sum %= 11; 11 | if (a[12] == 'X' && sum == 10 || a[12] != 'X' && sum + '0' == a[12]) 12 | cout << "Right" << endl; 13 | else { 14 | for (int i = 0; i < 12; i++) 15 | printf("%c", a[i]); 16 | if (sum == 10) printf("X\n"); 17 | else printf("%c\n", sum + '0'); 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /洛谷/P1059 明明的随机数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | const int maxm = 1010; 5 | int n, a, b[maxm]; 6 | int main() { 7 | cin >> n; 8 | int m = n; 9 | for (int i = 1; i <= n; i++) { 10 | cin >> a; 11 | if (b[a]) m--; 12 | b[a] = 1; 13 | } 14 | cout << m << endl; 15 | for (int i = 0; i <= 1000; i++) 16 | if (b[i]) 17 | cout << i << " "; 18 | return 0; 19 | } -------------------------------------------------------------------------------- /洛谷/P1060 开心的金明.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 30; 4 | const int maxm = 30010; 5 | int a[maxn], v[maxn], f[maxm]; 6 | int main() 7 | { 8 | int n, m; 9 | scanf("%d%d", &m, &n); 10 | for (int i = 1; i <= n; i++) 11 | scanf("%d%d", &v[i], &a[i]), 12 | a[i] *= v[i]; 13 | f[0] = 0; 14 | for (int i = 1; i <= n; i++) 15 | for (int j = m; j >= v[i]; j--) 16 | f[j] = max(f[j], f[j-v[i]] + a[i]); 17 | int maxx = -1; 18 | for (int i = 1; i <= m; i++) 19 | maxx = max(maxx, f[i]); 20 | cout << maxx << endl; 21 | } -------------------------------------------------------------------------------- /洛谷/P1067 多项式输出.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n, tmp; 6 | scanf("%d", &n); 7 | for (int i = n; i >= 0; i--) 8 | { 9 | scanf("%d", &tmp); 10 | if (tmp == 0) continue; 11 | if (tmp > 0 && i != n) printf("+"); 12 | if (tmp == -1 && i != 0) printf("-"); 13 | else if (tmp != 1 || i == 0) printf("%d", tmp); 14 | if (i == 1) printf("x"); 15 | else if (i != 0) printf("x^%d", i); 16 | } 17 | puts(""); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /洛谷/P1075 质因数分解.cpp: -------------------------------------------------------------------------------- 1 | var 2 | n,i:longint; 3 | begin 4 | read(n); 5 | for i:=2 to n do 6 | if n mod i=0 then begin 7 | write(n div i); 8 | break; 9 | end; 10 | end. -------------------------------------------------------------------------------- /洛谷/P1085 不高兴的津津.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | int i,t[8],a,b; 4 | for(i=1;i<=7;i++) 5 | { 6 | scanf("%d%d",&a,&b); 7 | t[i]=a+b; 8 | } 9 | a=0,b=0; 10 | for(i=1;i<=7;i++) 11 | if(t[i]>8&&t[i]>a) 12 | { 13 | a=t[i]; 14 | b=i; 15 | } 16 | printf("%d",b); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/P1089 津津的储蓄计划.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i, m, s, plan, flag=0, l=0, mark=0; 5 | for(m=1; m<=12; m++) 6 | { 7 | l+=300; 8 | scanf("%d",&plan); 9 | l = l - plan; 10 | if(l<0) 11 | { 12 | flag=1; 13 | break; 14 | } 15 | else 16 | { 17 | i = l/100; 18 | mark += (100*i); 19 | l -= (100*i); 20 | } 21 | } 22 | if(flag) 23 | printf("-%d",m); 24 | else 25 | { 26 | s=((1.2*mark) + l); 27 | printf("%d",s); 28 | } 29 | return 0; 30 | } -------------------------------------------------------------------------------- /洛谷/P1094 纪念品分组.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 30010; 4 | int w, n, a[maxn]; 5 | int main() { 6 | scanf("%d%d", &w, &n); 7 | for (int i = 1; i <= n; i++) 8 | scanf("%d", &a[i]); 9 | sort(a + 1, a + n + 1); 10 | int l = 1, r = n, ans = 0; 11 | while (l <= r) { 12 | if (a[l] + a[r] <= w) { 13 | l++, r--; 14 | ans++; 15 | } else { 16 | r--; 17 | ans++; 18 | } 19 | } 20 | cout << ans << endl; 21 | return 0; 22 | } -------------------------------------------------------------------------------- /洛谷/P1096 $Hanoi$双塔问题.cpp: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ans = 1 3 | for i in range(0, n): 4 | ans *= 2 5 | print (ans - 1) * 2 6 | -------------------------------------------------------------------------------- /洛谷/P1115 最大子段和.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 200010; 4 | int n, a[maxn]; 5 | int ans = 0, sum = 0; 6 | int main() { 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | ans = a[1]; 11 | for (int i = 1; i <= n; i++) { 12 | if (sum < 0 ) sum = 0; 13 | sum += a[i]; 14 | ans = max(ans, sum); 15 | } 16 | cout << ans << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/P1147 连续自然数和.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int m, sum, i, j; 4 | int main() { 5 | cin >> m; 6 | for (i = 1; i <= m / 2; i++) { 7 | sum = 0; 8 | for (j = i; j < m; j++) { 9 | sum += j; 10 | if (sum >= m) break; 11 | } 12 | if (sum == m) cout << i << ' ' << j << endl; 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /洛谷/P1149 火柴棒等式.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int i, j, ans = 0, n, t[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6}; 4 | int f (int num) { 5 | int i, k = 0; 6 | for (i = num; i != 0; i /= 10) k += t[i % 10]; 7 | if (num == 0) k += t[0]; 8 | return k; 9 | } 10 | int main(){ 11 | cin >> n; 12 | for(i = 0; i <= 1000; i++) 13 | for(j = 0;j <= 1000; j++) 14 | if(f(i) + f(j) + f(i + j) + 4 == n) ans++; 15 | cout << ans; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /洛谷/P1164 小A点菜.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | const int maxm = 1010; 5 | int n, m, a[maxn], f[2 * maxm]; 6 | int main() { 7 | cin >> n >> m; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | f[0] = 1; 11 | for (int i = 1; i <= n; i++) 12 | for (int j = m; j >= a[i]; j--) 13 | f[j] += f[j - a[i]]; 14 | cout << f[m] << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P1165 日志分析.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, x, y, t = 0, f[200010]; 4 | int main() 5 | { 6 | cin >> n; 7 | f[0] = 0; 8 | for (int i = 1; i <= n; i++) 9 | { 10 | cin>>x; 11 | if (x==0) 12 | { 13 | cin>>y; 14 | t++; 15 | f[t]=max(f[t-1],y); 16 | } 17 | if (x == 1) if (t != 0) t--; 18 | if (x == 2) cout << f[t] << endl; 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /洛谷/P1177 【模板】快速排序.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100010; 4 | int n, a[maxn]; 5 | int main() { 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) 8 | scanf("%d", &a[i]); 9 | sort(a + 1, a + n + 1); 10 | for (int i = 1; i <= n; i++) 11 | printf("%d ", a[i]); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /洛谷/P1181 数列分段Section I.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100000; 4 | int n, m, a[maxn]; 5 | int main() { 6 | cin >> n >> m; 7 | for (int i = 1; i <= n; i++) 8 | scanf("%d", &a[i]); 9 | int s = 0, ans = 0; 10 | for (int i = 1; i <= n; i++) { 11 | s += a[i]; 12 | if (s > m) { 13 | ans += 1; 14 | s = a[i]; 15 | } 16 | } 17 | ans ++; 18 | cout << ans << endl; 19 | return 0; 20 | } -------------------------------------------------------------------------------- /洛谷/P1192 台阶问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100010; 4 | int n, k, f[maxn]; 5 | int main() { 6 | scanf("%d%d", &n, &k); 7 | f[0] = 1; 8 | for (int i = 1; i <= n; i++) { 9 | for (int j = i - 1; j >= i - k && j >= 0; j--) 10 | f[i] = (f[i] + f[j]) % 100003; 11 | } 12 | // for (int i = 0; i <= n; i++) 13 | // printf("%d ", f[i]); 14 | // puts(""); 15 | printf("%d\n", f[n]); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /洛谷/P1200 [USACO1.1]你的飞碟在这儿Your Ride Is He….cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int cal(char *a) { 4 | int s = 1; 5 | for (int i = 0; i < strlen(a); i++) 6 | s *= a[i] - 'A' + 1; 7 | return s; 8 | } 9 | int main() { 10 | char a[10], b[10]; 11 | cin >> a >> b; 12 | if (cal(a) % 47 == cal(b) % 47) 13 | printf("GO\n"); 14 | else printf("STAY\n"); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P1208 [USACO1.3]混合牛奶 Mixing Milk.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxm = 1010; 4 | int n, m, x, y, b[maxm]; 5 | int main() { 6 | cin >> m >> n; 7 | for (int i = 1; i <= n; i++) { 8 | scanf("%d%d", &x, &y); 9 | b[x] += y; 10 | } 11 | long long ans = 0; 12 | for (int i = 0; i <= 1000; i++) { 13 | if (b[i] >= m) { 14 | ans += m * i; 15 | break; 16 | } else { 17 | ans += b[i] * i; 18 | m -= b[i]; 19 | } 20 | } 21 | cout << ans << endl; 22 | return 0; 23 | } -------------------------------------------------------------------------------- /洛谷/P1226 【模板】快速幂||取余运算.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define sqr(x) (x*x) 3 | using namespace std; 4 | long long n, m, k, t; 5 | int main() { 6 | scanf("%lld%lld%lld", &n, &m, &k); 7 | long long nn = n, mm = m; 8 | long long ans = 1; 9 | while(m > 0) { 10 | if(m % 2) ans = ans * n % k; 11 | n = n * n % k; 12 | m = m >> 1; 13 | } 14 | printf("%lld^%lld mod %lld=%lld\n", nn, mm, k, ans); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P1303 A*B Problem.cpp: -------------------------------------------------------------------------------- 1 | a=input() 2 | b=input() 3 | print int(a)*int(b) -------------------------------------------------------------------------------- /洛谷/P1307 数字反转.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxl = 256; 4 | char str[maxl]; 5 | int b, i, j; 6 | int main() { 7 | gets(str); 8 | i = 0, j = strlen(str); 9 | if (str[i] == '-') b = 1, i++; 10 | else b = 0; 11 | while (str[i] == '0') i++; 12 | while (str[j - 1] == '0') j--; 13 | if (b && j - 1 > i) cout << '-'; 14 | if (j - 1 < i) cout << 0; 15 | for (int k = j - 1; k >= i; k--) 16 | cout << str[k]; 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /洛谷/P1338 末日的传说 .cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 50010; 4 | long long n, m, l, r, a[maxn]; 5 | int main() { 6 | scanf("%lld%lld", &n, &m); 7 | l = 1, r = n; 8 | for (int i = 1; i <= n; i++) { 9 | // cout << l5 << " " << r << endl; 10 | if ((n - i) * (n - i - 1) / 2 >= m) a[l++] = i; 11 | else a[r--] = i, m -= r - l + 1; 12 | } 13 | for (int i = 1; i <= n; i++) 14 | printf("%lld ", a[i]); 15 | putchar('\n'); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /洛谷/P1372 又是毕业季I.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, k; 4 | int main() { 5 | cin >> n >> k; 6 | cout << n / k << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/P1403 [AHOI2005]约数研究.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, i; 4 | long long ans = 0; 5 | int main() { 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) 8 | ans += n / i; 9 | cout << ans << endl; 10 | return 0; 11 | } -------------------------------------------------------------------------------- /洛谷/P1421 小玉买文具.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a,b,c,r; 4 | int main() 5 | { 6 | cin>>a>>b; 7 | cout<<(a*10+b)/19< 2 | using namespace std; 3 | int main(){ 4 | int a=0; 5 | double b=0; 6 | cin>>a; 7 | if(a<=150){ 8 | b=a*0.4463; 9 | }else if(a>=151&&a<=400){ 10 | b=150*0.4463; 11 | b+=(a-150)*0.4663; 12 | }else{ 13 | b=150*0.4463; 14 | b+=(400-150)*0.4663; 15 | b+=(a-400)*0.5663; 16 | } 17 | b=int((b*10)+0.5)/10.0; 18 | cout< 2 | using namespace std; 3 | int main() { 4 | int ans = 0; 5 | double u, v = 2; 6 | cin >> u; 7 | while (u > 0) { 8 | u -= v; 9 | v *= 0.98; 10 | ans += 1; 11 | } 12 | cout << ans << endl; 13 | } -------------------------------------------------------------------------------- /洛谷/P1425 小鱼的游泳时间.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int h1,h2,m1,m2; 5 | scanf("%d %d %d %d",&h1,&m1,&h2,&m2); 6 | if(m2 2 | using namespace std; 3 | double v = 7, s, x; 4 | int main() { 5 | cin >> s >> x; 6 | while (s > x) { 7 | s -= v; 8 | v *= 0.98; 9 | } 10 | if (s - v < -x) puts("n"); 11 | else puts("y"); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /洛谷/P1427 小鱼的数字游戏.cpp: -------------------------------------------------------------------------------- 1 | //以前打的代码,现在那个账号上不去了,所以再交一遍 2 | #include 3 | #define ll long long 4 | using namespace std; 5 | ll a[101]; 6 | int main() 7 | { 8 | ll temp=1; 9 | int k=0; 10 | while (temp!=0) 11 | { 12 | scanf("%lld",&temp); 13 | a[k++]=temp; 14 | } 15 | for (int i=k-2;i>=0;i--) printf("%d ",a[i]); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /洛谷/P1428 小鱼比可爱.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int n, a[110]; 3 | int main() { 4 | std::cin >> n; 5 | for (int i = 1; i <= n; i++) { 6 | std::cin >> a[i]; 7 | for (int j = 1; j < i; j++) 8 | if (a[i] > a[j]) a[i + 1]++; 9 | std::cout << a[i + 1] << " "; 10 | } 11 | } -------------------------------------------------------------------------------- /洛谷/P1478 陶陶摘苹果(升级版).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 5010, maxm = 1010; 4 | int n, m, x, y, h, ans = 0, a[maxn], b[maxn], f[maxm]; 5 | int main() { 6 | 7 | scanf("%d%d%d%d", &n, &m, &x, &y); 8 | h = x + y; 9 | for (int i = 1; i <= n; i++) { 10 | scanf("%d%d", &a[i], &b[i]); 11 | if (h >= a[i]) { 12 | for (int j = m; j >= b[i]; j--) 13 | f[j] = max(f[j], f[j - b[i]] + 1); 14 | } 15 | } 16 | for (int i = 1; i <= m; i++) 17 | ans = max(ans, f[i]); 18 | printf("%d\n", ans); 19 | 20 | return 0; 21 | } -------------------------------------------------------------------------------- /洛谷/P1482 Cantor表(升级版).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int g(int a,int b) { 4 | return b==0?a:g(b,a%b); 5 | } 6 | int a,b,x,y,s; 7 | char m,n; 8 | int main() { 9 | cin>>a>>m>>b; 10 | cin>>x>>n>>y; 11 | x*=a;y*=b;s=g(x,y); 12 | x/=s;y/=s; 13 | cout< 2 | using namespace std; 3 | const int maxn = 10010; 4 | int a[maxn], v[maxn], f[maxn]; 5 | int main() { 6 | int x, n, m; 7 | scanf("%d%d%d", &x, &n, &m); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d%d", &a[i], &v[i]); 10 | f[0] = 0; 11 | for (int i = 1; i <= n; i++) 12 | for (int j = m; j >= v[i]; j--) 13 | f[j] = max(f[j], f[j - v[i]] + a[i]); 14 | for (int i = 0; i <= m; i++) 15 | if (f[i] >= x) { 16 | printf("%d", m - i); 17 | return 0; 18 | } 19 | printf("Impossible\n"); 20 | return 0; 21 | } -------------------------------------------------------------------------------- /洛谷/P1548 棋盘问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, m, s1 = 0, s2 = 0; 4 | int main() { 5 | scanf("%d%d", &n, &m); 6 | s2 = ((m + 1) * (n + 1) * m * n) / 4; 7 | for(; m >= 1 && n >= 1; m--, n--) 8 | s1 += m * n; 9 | printf("%d %d", s1, s2 - s1); 10 | return 0; 11 | } -------------------------------------------------------------------------------- /洛谷/P1567 统计天数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin>>n; 7 | int a[n],ans=1,max=1; 8 | for(int i=0;i>a[i]; 11 | if(a[i]<=a[i-1]&&i!=0) ans=1; 12 | if(a[i]>a[i-1]&&i!=0) 13 | { 14 | ++ans; 15 | if(ans>max) max=ans; 16 | } 17 | }printf("%d",max); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /洛谷/P1579 哥德巴赫猜想(升级版).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxm = 20010; 4 | int n, a, b, c, f[maxm]; 5 | int main() { 6 | cin >> n; 7 | for (int i = 2; i <= n; i++) 8 | if (!f[i]) { 9 | for (int j = i + i; j <= n; j += i) 10 | f[j] = 1; 11 | } 12 | for (a = 2; a <= n; a++) 13 | for (b = a; a + b <= n / 2; b++) { 14 | c = n - a - b; 15 | // printf("%d %d %d\n", a, b, c); 16 | if (!f[a] && !f[b] && !f[c]) { 17 | printf("%d %d %d\n", a, b, c); 18 | return 0; 19 | } 20 | } 21 | return 0; 22 | } -------------------------------------------------------------------------------- /洛谷/P1582 倒水.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n, m, k, t, cnt; 4 | int main() { 5 | scanf("%lld%lld", &n, &k); 6 | m = n; 7 | while (1) { 8 | cnt = 0, t = m; 9 | while (t > 0) { 10 | cnt += t % 2; 11 | t /= 2; 12 | } 13 | if (cnt <= k) break; 14 | m += m & -m; 15 | } 16 | printf("%lld", m - n); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /洛谷/P1616 疯狂的采药.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10010; 4 | const int maxm = 100010; 5 | int n, m, a[maxn], v[maxn], f[maxm]; 6 | int main() { 7 | cin >> m >> n; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d%d", &a[i], &v[i]); 10 | for (int i = 1; i <= n; i++) 11 | for (int j = a[i]; j <= m; j++) 12 | f[j] = max(f[j], f[j - a[i]] + v[i]); 13 | cout << f[m] << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /洛谷/P1634 禽兽的传染病.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | long long x, n, ans = 1; 5 | cin >> x >> n; 6 | for (int i = 1; i <= n; i++) 7 | ans *= x+1; 8 | cout << ans << endl; 9 | return 0; 10 | } -------------------------------------------------------------------------------- /洛谷/P1739 表达式括号匹配.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | char c = getchar(); 5 | int cnt = 0; 6 | while (c != '@') { 7 | if (c == '(') cnt++; 8 | if (c == ')') cnt--; 9 | if (cnt < 0) { 10 | puts("NO"); 11 | return 0; 12 | } 13 | c = getchar(); 14 | } 15 | if (cnt) puts("NO"); 16 | else puts("YES"); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/P1804 【保留题目】.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/洛谷/P1804 【保留题目】.cpp -------------------------------------------------------------------------------- /洛谷/P1888 三角函数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long a[3]; 4 | long long q,w; 5 | long long gcd(long long a,long long b) { 6 | return b==0?a:gcd(b,a%b); 7 | } 8 | int main() 9 | { 10 | for(int i=0;i<3;i++) cin>>a[i]; 11 | sort(a,a+3); 12 | q=a[0]/gcd(a[0],a[2]); 13 | w=a[2]/gcd(a[0],a[2]); 14 | cout< 2 | using namespace std; 3 | int n, m, s, ans = 2 << 25, a[10], b[10]; 4 | int main() 5 | { 6 | cin >> n; 7 | for (int i = 1; i <= 3; i++) 8 | cin >> a[i] >> b[i]; 9 | for (int i = 1; i <= 3; i++) 10 | { 11 | if (n % a[i] == 0) m = n / a[i]; 12 | else m = n / a[i] + 1; 13 | s = m * b[i]; 14 | if (s < ans) ans = s; 15 | } 16 | cout << ans; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/P1914 小书童——密码.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | string s; 4 | int k; 5 | int main() { 6 | cin >> k >> s; 7 | for (int i = 0; i < s.length(); i++) { 8 | s[i] = ((s[i] + k - 'a') % 26 + 'a'); 9 | } 10 | cout << s << endl; 11 | } -------------------------------------------------------------------------------- /洛谷/P1919 【模板】A*B Problem升级版(FFT快速傅里叶).cpp: -------------------------------------------------------------------------------- 1 | input() 2 | print(int(input()) * int(input())) -------------------------------------------------------------------------------- /洛谷/P1932 A+B A-B A*B A_B A%B Problem.cpp: -------------------------------------------------------------------------------- 1 | a , b = int(input()), int(input()) 2 | print(a + b) 3 | print(a - b) 4 | print(a * b) 5 | print(a // b) 6 | print(a % b) -------------------------------------------------------------------------------- /洛谷/P1980 计数问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, x, ans = 0; 4 | int main() { 5 | scanf("%d%d", &n, &x); 6 | int t; 7 | for (int i = 1; i <= n; i++) { 8 | t = i; 9 | while (t > 0) { 10 | if (t % 10 == x) ans ++; 11 | t = t / 10; 12 | } 13 | } 14 | printf("%d", ans); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P1981 表达式求值 .cpp: -------------------------------------------------------------------------------- 1 | print(input()%10000) -------------------------------------------------------------------------------- /洛谷/P1996 约瑟夫问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | bool dis[maxn]; 5 | int main() { 6 | int n, m; 7 | cin >> n >> m; 8 | int i, j = 0, t; 9 | for (i = 1; i <= n; i++) { 10 | for (t = 1; t <= m;) { 11 | j = j % n + 1; 12 | if (!dis[j]) t++; 13 | } 14 | dis[j] = 1; 15 | printf("%d ", j); 16 | } 17 | puts(""); 18 | return 0; 19 | } -------------------------------------------------------------------------------- /洛谷/P2005 A_B Problem II.cpp: -------------------------------------------------------------------------------- 1 | print(int(input())//int(input())) -------------------------------------------------------------------------------- /洛谷/P2010 回文日期.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, m, a, b, c, sum, ans; 4 | int s[13]={0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 5 | int main() { 6 | cin >> n >> m; 7 | for (int i = 1; i <= 12; i++) 8 | for (int j = 1; j <= s[i];j++) { 9 | c = (j % 10) * 1000 + (j / 10) * 100 + (i % 10) * 10 + (i / 10); 10 | sum = c * 10000 + i * 100 + j; 11 | if (sum < n || sum > m) continue; 12 | ans++; 13 | } 14 | cout << ans << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P2025 脑力大人之监听电话.cpp: -------------------------------------------------------------------------------- 1 | // luogu-judger-enable-o2 2 | // luogu-judger-enable-o2 3 | // luogu-judger-enable-o2 4 | #include 5 | int n, x, y, s; 6 | int main() { 7 | scanf("%d%d", &n, &y), s = y; 8 | for (int i = 2; i <= n; i++) { 9 | x = y, scanf("%d", &y); 10 | if (y > x) s += y - x; 11 | } 12 | printf("%d", s); 13 | } -------------------------------------------------------------------------------- /洛谷/P2118 比例简化.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a, b, n, m, l, ans_a, ans_b; 4 | double x, ans_c; 5 | int main() { 6 | cin >> n >> m >> l; 7 | ans_c = n + m; 8 | for (int i = 1; i <= l; i++) { 9 | a = i, b = i * m / n; 10 | if (b > l) b = l; 11 | x = (a / (double)b) - (n / (double)m); 12 | // cout << x << endl; 13 | if (x >= 0 && x < ans_c) { 14 | ans_a = a; 15 | ans_b = b; 16 | ans_c = x; 17 | } 18 | } 19 | cout << ans_a << " " << ans_b << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /洛谷/P2141 珠心算测验.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | int a[110]; 6 | long long ans = 0; 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) 9 | cin >> a[i]; 10 | bool b; 11 | for (int i = 1; i <= n; i++) { 12 | b = false; 13 | for (int j = 1; j <= n; j++) 14 | for (int k = j + 1; k <= n; k++) 15 | if (a[j] + a[k] == a[i]) 16 | b = true; 17 | if (b) ans++; 18 | } 19 | cout << ans << endl; 20 | return 0; 21 | } -------------------------------------------------------------------------------- /洛谷/P2142 高精度减法.cpp: -------------------------------------------------------------------------------- 1 | a=input() 2 | b=input() 3 | print(int(a)-int(b)) -------------------------------------------------------------------------------- /洛谷/P2144 [FJOI2007]轮状病毒.cpp: -------------------------------------------------------------------------------- 1 | def locate(x): 2 | a = [1, 3] 3 | for i in range(2, x): 4 | a.append(a[-1] + a[-2]) 5 | # print(a) 6 | return a[x - 1] 7 | 8 | def solve(x): 9 | t = locate(x) 10 | if x % 2 == 1: 11 | return t ** 2 12 | else: 13 | return t ** 2 - 4 14 | 15 | n = int(input()) 16 | print(solve(n)) 17 | -------------------------------------------------------------------------------- /洛谷/P2152 [SDOI2009]SuperGCD.cpp: -------------------------------------------------------------------------------- 1 | import math 2 | a = int(input()) 3 | b = int(input()) 4 | print(str(math.gcd(a, b))) -------------------------------------------------------------------------------- /洛谷/P2347 砝码称重.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 30; 4 | const int maxm = 1010; 5 | int n = 20, a[maxn]; 6 | long long sum = 0, ans = 0; 7 | int f[maxm]; 8 | int main() 9 | { 10 | cin >> a[1] >> a[2] >> a[3] >> a[5] >> a[10] >> a[20]; 11 | f[0] = 1; 12 | for (int i = 1; i <= n; i++) 13 | for (int k = 1; k <= a[i]; k++) 14 | for (int j = maxm; j >= i; j--) 15 | f[j] |= f[j-i]; 16 | for (int i = 1; i <= maxm; i++) 17 | ans += f[i]; 18 | printf("Total=%d", ans); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /洛谷/P2394 yyy loves Chemistry I.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | long double n, x; 4 | scanf("%18Lf", &n); 5 | printf("%0.8Lf", n / 23); 6 | return 0; 7 | } -------------------------------------------------------------------------------- /洛谷/P2397 yyy loves Maths VI (mode).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, t, cnt, u; 4 | int main() { 5 | scanf("%d", &n); 6 | while (n--) { 7 | scanf("%d", &t); 8 | if (cnt == 0) { 9 | u = t; 10 | cnt = 1; 11 | } else if (t == u) cnt++; 12 | else cnt--; 13 | } 14 | printf("%d", u); 15 | return 0; 16 | } -------------------------------------------------------------------------------- /洛谷/P2626 斐波那契数列(升级版).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n, f[50] = {0, 1, 1}; 4 | long long g(long long x) { 5 | if (f[x]) return f[x]; 6 | return f[x] = (g(x - 1) + g(x - 2)) % (1 << 31); 7 | } 8 | int main() { 9 | cin >> n; 10 | n = g(n); 11 | printf("%d=", n); 12 | bool mark = false; 13 | for (int i = 2; i <= n; i++) 14 | while (!(n % i)) { 15 | n /= i; 16 | if (mark) putchar('*'); 17 | else mark = true; 18 | printf("%d", i); 19 | } 20 | return 0; 21 | } -------------------------------------------------------------------------------- /洛谷/P2639 [USACO09OCT]Bessie的体重问题Bessie's We….cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 510; 4 | const int maxm = 45010; 5 | int n, m, a[maxn], f[maxm]; 6 | int main() 7 | { 8 | cin >> m >> n; 9 | for (int i = 1; i <= n; i++) 10 | scanf("%d", &a[i]); 11 | f[0] = 1; 12 | for (int i = 1; i <= n; i++) 13 | for (int j = m; j >= a[i]; j--) 14 | f[j] |= f[j-a[i]]; 15 | for (int j = m; j >= 0; j--) 16 | if (f[j]) 17 | { 18 | printf("%d", j); 19 | return 0; 20 | } 21 | return 0; 22 | } -------------------------------------------------------------------------------- /洛谷/P2669 金币.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n, sum = 0, cnt = 1; 4 | int main () 5 | { 6 | cin >> n; 7 | for (int i = 1; cnt <= n; i++) 8 | for (int j = 1; j <= i && cnt <= n; j++, cnt++) 9 | sum += i; 10 | cout << sum; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /洛谷/P2788 数学1(math1)- 加减算式.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int ans, t; 4 | int main() { 5 | while (cin >> t) 6 | ans += t; 7 | cout << ans; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /洛谷/P2911 [USACO08OCT]牛骨头Bovine Bones.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int a, b, c, f[100]; 5 | memset(f, 0, sizeof(f)); 6 | cin >> a >> b >> c; 7 | for (int i = 1; i <= a; i++) 8 | for (int j = 1; j <= b; j++) 9 | for (int k = 1; k <= c; k++) 10 | f[i + j + k]++; 11 | int max = -1, ans; 12 | for (int i = 3; i < 100; i++) 13 | if (f[i] > max) { 14 | max = f[i]; 15 | ans = i; 16 | } 17 | cout << ans << endl; 18 | return 0; 19 | } -------------------------------------------------------------------------------- /洛谷/P3370 【模板】字符串哈希.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10010; 4 | int n; 5 | char str[10010]; 6 | set < string > st; 7 | int main() { 8 | cin >> n; 9 | for (int i = 1; i <= n; i++) { 10 | scanf("%s", str); 11 | st.insert(str); 12 | } 13 | cout << st.size() << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /洛谷/P3383 【模板】线性筛素数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100010; 4 | const int maxm = 10000010; 5 | int n, m, a, f[maxm]; 6 | int main() { 7 | cin >> m >> n; 8 | f[0] = f[1] = 1; 9 | for (int i = 2; i * i <= m; i++) 10 | if (!f[i]) { 11 | for (int j = i + i; j <= m; j += i) 12 | f[j] = 1; 13 | } 14 | for (int i = 1; i <= n; i++) { 15 | scanf("%d", &a); 16 | if (f[a]) puts("No"); 17 | else puts("Yes"); 18 | } 19 | return 0; 20 | } -------------------------------------------------------------------------------- /洛谷/P3811 【模板】乘法逆元.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define ll long long 3 | using namespace std; 4 | const int maxn = 3 * 1e6 + 10; 5 | ll n, p, a[maxn]; 6 | int main() { 7 | scanf("%lld%lld", &n, &p); 8 | a[0] = a[1] = 1; 9 | for (int i = 2; i <= n; i++) 10 | a[i] = (p - p / i) * a[p % i] % p; 11 | for (int i = 1; i <= n; i++) 12 | printf("%lld\n", a[i]); 13 | return 0; 14 | } -------------------------------------------------------------------------------- /洛谷/P3951 小凯的疑惑.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | long long a, b; 5 | cin >> a >> b; 6 | cout << (a * b - a - b) << endl; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/P3954 成绩.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int x, y, z; 5 | cin >> x >> y >> z; 6 | int s = x * 0.2 + y * 0.3 + z * 0.5; 7 | cout << s << endl; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /洛谷/P3978 [TJOI2015]概率论.cpp: -------------------------------------------------------------------------------- 1 | // luogu-judger-enable-o2 2 | // luogu-judger-enable-o2 3 | #include 4 | using namespace std; 5 | int main() { 6 | double n; 7 | scanf("%lf", &n); 8 | printf("%.12lf\n", n * (n + 1) / (2 * (2 * n - 1))); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /洛谷/P4325 [COCI2006-2007#1] Modulo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int t, ans; 4 | set < int > Set; 5 | int main() { 6 | for (int i = 1; i <= 10; i++) { 7 | cin >> t; 8 | if (!Set.count(t % 42)) { 9 | Set.insert(t % 42); 10 | ans++; 11 | } 12 | } 13 | cout << ans << endl; 14 | return 0; 15 | } -------------------------------------------------------------------------------- /洛谷/P5015 标题统计.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int ans = 0, c; 5 | while ((c = getchar()) != EOF) 6 | if (isdigit(c) || isupper(c) || islower(c)) 7 | ++ans; 8 | printf("%d\n", ans); 9 | return 0; 10 | } -------------------------------------------------------------------------------- /洛谷/P5019 铺设道路.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, a, b, ans; 4 | int main() { 5 | for (scanf("%d", &n); n--; ) { 6 | scanf("%d", &b); 7 | if (b - a > 0) ans += b - a; 8 | a = b; 9 | } 10 | printf("%d\n", ans); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /洛谷/SP1 TEST - Life, the Universe, and Everything.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | long long t = 0; 5 | scanf("%d", &t); 6 | while (t != 42) { 7 | printf("%d\n", t); 8 | scanf("%d", &t); 9 | } 10 | return 0; 11 | } -------------------------------------------------------------------------------- /洛谷/SP27561 GDCOFTI - Greatest Common Divisor Of Three Integers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | long long a, b, c; 5 | cin >> a >> b >> c; 6 | cout << __gcd(a, __gcd(b, c)); 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/T15222 A+b问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int a, b; 5 | cin >> a >> b; 6 | cout << a + b + 10; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /洛谷/T17379 #024 【模板】进制转换.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, r, s[10010]; 4 | int main() { 5 | scanf("%d%d", &n, &r); 6 | if (n == 0) { 7 | printf("%d", 0); 8 | } 9 | while (n > 0) { 10 | s[++s[0]] = n % r; 11 | n /= r; 12 | } 13 | for (int i = s[0]; i > 0; i--) 14 | printf("%d", s[i]); 15 | puts(""); 16 | return 0; 17 | } -------------------------------------------------------------------------------- /洛谷/T23806 [愚人节题目4]Sum of a and b.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | short a, b, c; 4 | int main() { 5 | cin >> a >> b; 6 | c = (short)((short)a + (short)b); 7 | cout << c; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /洛谷/T30159 [BZOJ1000] A+B Problem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { 3 | int a, b; 4 | std::cin >> a >> b; 5 | std::cout << a + b << std::endl; 6 | return 0; 7 | } -------------------------------------------------------------------------------- /洛谷/T36196 【BOR-08】求10000以内n的阶乘.cpp: -------------------------------------------------------------------------------- 1 | n = int(input()) 2 | ans = 1 3 | for i in range(1, n + 1): 4 | ans *= i 5 | print ans -------------------------------------------------------------------------------- /洛谷/UVA100 The 3n + 1 problem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int Solve(int x,int ret) { 5 | if(x==1) //当数字为1是返回周期长度 6 | return ret; 7 | int t=x&1? x*3+1:x/2; 8 | return Solve(t,ret+1); //继续递归求值 9 | } 10 | int main() { 11 | for(int i,j,ans;~scanf("%d%d",&i,&j);) { 12 | ans=0; 13 | for(int k=min(i,j),l=max(i,j);k<=l;++k) 14 | ans=max(ans,Solve(k,1)); 15 | printf("%d %d %d\n",i,j,ans); //注意,i与j的顺序是输入中的顺序 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /洛谷/UVA151 Power Crisis.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int n; 4 | 5 | int main() { 6 | while (scanf("%d", &n), n) { 7 | for(int i = 1; i < n; i++) { 8 | int k = 0; 9 | for(int j = 1; j < n; j++) 10 | k = (k + i) % j; 11 | if(k == 11) { 12 | printf("%d\n", i); 13 | break; 14 | } 15 | } 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /白马湖OJ/1000 白马湖欢迎你.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | printf("**********************************************\n*Welcome To Hangzhou No.2 High School Baimahu*\n**********************************************"); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /白马湖OJ/1002 字符菱形.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | char c; 8 | cin >> c; 9 | printf(" %c\n %c%c%c\n%c%c%c%c%c\n %c%c%c\n %c", c, c, c, c, c, c, c, c, c, c, c, c, c); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /白马湖OJ/1003 对齐输出.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int a, b, c; 8 | cin >> a >> b >> c; 9 | printf("%5d\n%5d\n%5d\n", a, b, c); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /白马湖OJ/1004 浮点数输出.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | float f; 8 | cin >> f; 9 | printf("%f\n%.5f", f, f); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /白马湖OJ/1005 简易加法器.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int a, b; 7 | cin >> a >> b; 8 | cout << a + b << endl; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /白马湖OJ/1006.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int a, b; 7 | cin >> a >> b; 8 | cout << a / b << " " << a % b << endl; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /白马湖OJ/1007.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | double a, b; 7 | cin >> a >> b; 8 | while (a > 0) a -= b; 9 | if (a == 0); 10 | else a += b; 11 | printf("%.2lf\n", a); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /白马湖OJ/1008.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int a; 7 | cin >> a; 8 | cout << (a % 10 + a / 10 % 10 + a / 100) ; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /白马湖OJ/1009.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int n; 7 | cin >> n; 8 | int a, b, c; 9 | a = n / 100; 10 | b = n / 10 % 10; 11 | c = n % 10; 12 | n = a + b * 10 + c * 100; 13 | cout << n; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1010.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | char a, b, c; 7 | scanf("%c %c %c", &a, &b, &c); 8 | cout << (int)a << " " << (int)b << " " << (int)c < 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int a, b, c; 7 | cin >> a >> b >> c; 8 | if (a + b == c) 9 | { 10 | printf("YES!\n"); 11 | } 12 | else 13 | { 14 | printf("NO!\n"); 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1031.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | char c; 7 | cin >> c; 8 | if (c %2 == 1) cout << "YES\n"; 9 | else cout << "NO\n"; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /白马湖OJ/1032.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin >> n; 7 | int k = 0; 8 | while (n > 0) 9 | { 10 | ++k; 11 | n /= 10; 12 | } 13 | cout << k << endl; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1033.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin >> n; 7 | int a,b; 8 | a = 30 + 27 + n / 3.0; 9 | b = n / 1.2; 10 | if (a > b) cout << "Walk"; 11 | else if (a == b) cout << "All"; 12 | else cout << "Bike"; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /白马湖OJ/1034.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | double a, b, s; 6 | cin >> a >> b; 7 | s = a * 0.7 + b * 0.3; 8 | if (s >= 90) cout << "A"; 9 | else if (s >= 80) cout << "B"; 10 | else if (s >= 70) cout << "C"; 11 | else cout << "D"; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /白马湖OJ/1035.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int k[20] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 6 | int year, month; 7 | cin >> year >> month; 8 | if (month != 2) cout << k[month]; 9 | else 10 | { 11 | if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) cout << 29; 12 | else cout << 28; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1036.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int a, b, s; 8 | char c; 9 | cin >> a >> b; 10 | cin >> c; 11 | if (c == '+') s = a + b; 12 | else if (c == '-') s = a - b; 13 | else if (c == '*') s = a * b; 14 | else if (c == '/') 15 | { 16 | if (b == 0) {cout << "Divided by zero!"; return 0;} 17 | else s = a / b; 18 | } 19 | else {cout << "Invalid operator!"; return 0;} 20 | cout << s; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1037.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | void change(int &a, int &b) 5 | { 6 | int t; 7 | t = a; 8 | a = b; 9 | b = t; 10 | } 11 | int main() 12 | { 13 | int a, b, c; 14 | cin >> a >> b >> c; 15 | if (a > b) change(a, b); 16 | if (a > c) change(a, c); 17 | if (b > c) change(b, c); 18 | if (a + b <= c) 19 | { 20 | printf("not a triangle\n"); 21 | } 22 | else if (a * a + b * b == c * c) 23 | { 24 | cout << "YES\n"; 25 | } 26 | else 27 | { 28 | cout << "NO\n"; 29 | } 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /白马湖OJ/1038.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | void f(int &a, int &b) 5 | { 6 | int t; 7 | t = a; a = b; b = t; 8 | } 9 | int main() 10 | { 11 | int a, b, c; 12 | cin >> a >> b >> c; 13 | if (a < b) f(a, b); 14 | else if (a < c) f(a, c); 15 | else if (b < c) f(b, c); 16 | if (a < b) f(a, b); 17 | else if (a < c) f(a, c); 18 | else if (b < c) f(b, c); 19 | if (a < b) f(a, b); 20 | else if (a < c) f(a, c); 21 | else if (b < c) f(b, c); 22 | cout << a << " " << b << " " << c; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1039.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | double a, b; 8 | cin >> a >> b; 9 | if (b >= 5) b = b / 2.0; 10 | printf("%.2lf", a * b); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/1040.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | double x, y, z; 7 | double a, b, c; 8 | cin >> x >> y >> z; 9 | cin >> a >> b >> c; 10 | double s = a * x + b * y + c * z; 11 | if ((bool)a + (bool)b + (bool)c >= 2 ) s = s / 2.0; 12 | printf("%.2lf", s); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /白马湖OJ/1051.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /白马湖OJ/1060.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) 8 | { 9 | if (i % 2 == 1) printf("%d ", i); 10 | } 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /白马湖OJ/1061.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n, temp; 6 | long long sum = 0; 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) 9 | { 10 | cin >> temp; 11 | sum += temp; 12 | } 13 | printf("%lld", sum); 14 | return 0; 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /白马湖OJ/1062.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long f(int n) 4 | { 5 | long long ans = 1; 6 | for (int i = 1; i <= n; i++) ans *= i; 7 | return ans; 8 | } 9 | int main() 10 | { 11 | long long n; 12 | cin >> n; 13 | printf("%lld", f(n)); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /白马湖OJ/1063.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | long long n, temp; 6 | cin >> n; 7 | long long max = -1; 8 | for (int i = 1; i <= n; i++) 9 | { 10 | cin >> temp; 11 | if (temp > max) max = temp; 12 | } 13 | cout << max; 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /白马湖OJ/1064.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int k[100]; 4 | int f(int n) 5 | { 6 | if (n == 0) return 0; 7 | else if (n == 1) return 1; 8 | else if (n == 2) return 2; 9 | else if (k[n] != 0) return k[n]; 10 | else 11 | { 12 | k[n] = f(n - 1) + f (n - 2); 13 | return k[n]; 14 | } 15 | } 16 | int main() 17 | { 18 | int n; 19 | cin >> n; 20 | cout << f(n); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1065.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /白马湖OJ/1065_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /白马湖OJ/1067.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | double temp; 7 | cin >> n; 8 | cin >> temp; 9 | double max = temp, min = temp, sum = temp; 10 | for (int i = 2; i <= n; i++) 11 | { 12 | cin >> temp; 13 | if(temp > max) max = temp; 14 | if(temp < min) min = temp; 15 | sum += temp; 16 | } 17 | sum = (sum - max - min) / (n - 2); 18 | printf("%.2lf", sum); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1070.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | int ans = 0; 7 | cin >> n; 8 | while (n != 1) 9 | { 10 | if (n % 2 == 0) n = n / 2; 11 | else n = 3 * n + 1; 12 | ans++; 13 | } 14 | printf("%d", ans); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /白马湖OJ/1071.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) 8 | { 9 | for (int j = 1; j <= i; j++) 10 | { 11 | printf("%c", '*'); 12 | } 13 | puts(""); 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /白马湖OJ/1072.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | void f(char c, int n) 4 | { 5 | for (int i = 1; i <= n; i++) printf("%c", c); 6 | } 7 | int main() 8 | { 9 | int n; 10 | cin >> n; 11 | for (int i = 1; i <= n; i++) 12 | { 13 | f(' ', (n - i)); 14 | f('*', (i * 2 - 1)); 15 | puts(""); 16 | } 17 | for (int i = (n - 1); i >= 1; i--) 18 | { 19 | f(' ', (n - i)); 20 | f('*', (i * 2 - 1)); 21 | puts(""); 22 | } 23 | return 0; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /白马湖OJ/1073.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin >> n; 7 | if (n >= 6) printf("%d\n", 6); 8 | if (n >= 28) printf("%d\n", 28); 9 | if (n >= 496) printf("%d\n", 496); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /白马湖OJ/1074.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int f(int n) 4 | { 5 | int ans = 1; 6 | for (int i = 1; i <= n; i++) ans *= i; 7 | return ans; 8 | } 9 | int main() 10 | { 11 | int n; 12 | cin >> n; 13 | int sum = 0; 14 | for (int i = 1; i <= n; i++) 15 | { 16 | sum += f(i); 17 | } 18 | printf("%d", sum); 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /白马湖OJ/1075.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cin >> n; 7 | long long sum = 0, k = 0; 8 | for (int i = 1; i <= n; i++) 9 | { 10 | k = k * 10 + 6; 11 | sum += k; 12 | } 13 | printf("%lld", sum); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /白马湖OJ/1076.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | unsigned long long f(unsigned long long a, unsigned long long b) 7 | { 8 | return b==0?a:f(b,a%b); 9 | } 10 | int main() 11 | { 12 | unsigned long long a, b, c = 1, s = 0; 13 | cin >> a >> b; 14 | s = f(a, b); 15 | cout << s; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1076_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | long long a, b; 8 | scanf("%lld%lld", &a, &b); 9 | for (int i = b; i = 1; i--) 10 | { 11 | if (a % i == 0 && b % i == 0) 12 | { 13 | printf("%d", i); 14 | return 0; 15 | } 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /白马湖OJ/1077.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | long long f(long long a, long long b) 7 | { 8 | return b==0?a:f(b,a%b); 9 | } 10 | int main() 11 | { 12 | long long a, b, c = 1, s = 0; 13 | scanf("%lld%lld", &a, &b); 14 | s = f(a, b); 15 | s = (a / s) * b; 16 | printf("%lld", s); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /白马湖OJ/1078.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | scanf("%d", &n); 10 | for (int i = 1; i <= (n - 1); i++) 11 | printf("%d ", i); 12 | for (int i = n; i >= 1; i--) 13 | { 14 | printf("%d", i); 15 | if (i != 1) printf(" "); 16 | } 17 | //printf("*"); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1079.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | scanf("%d", &n); 10 | for (int i = 1; i <= n; i++) 11 | { 12 | for (int j = 1; j <= (40 - i); j++) 13 | printf(" "); 14 | for (int j = 1; j <= i; j++) 15 | printf("%d", j); 16 | for (int j = (i - 1); j >= 1; j--) 17 | printf("%d", j); 18 | puts(""); 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1081.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | scanf("%d", &n); 10 | int s = 0; 11 | for (int i = 1; i <= n; i++) 12 | { 13 | for (int j = 1; j <= (n - i + 1); j++) 14 | { 15 | printf("%4d", ++s); 16 | } 17 | puts(""); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1082.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int a[110][110]; 7 | int main() 8 | { 9 | int n; 10 | scanf("%d", &n); 11 | int s = 0; 12 | for (int i = 1; i <= n; i++) 13 | for (int j = 1; j <= (n - i + 1); j++) 14 | a[i][j] = ++s; 15 | for 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1082_12.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int n, s; 9 | scanf("%d", &n); 10 | for (int i = 1; i <= n; i++) 11 | { 12 | s = i; 13 | for (int j = 1; j <= (n + 1 - i); j++) 14 | { 15 | printf("%4d", s); 16 | s += n + 1 - j; 17 | } 18 | puts(""); 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1098.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | int sum = 0, temp = 0, n3; 10 | cin >> n; 11 | for (int i = 1; i <= n; i++) 12 | { 13 | if(i == 3) {cin >> n3; sum += n3; continue;} 14 | cin >> temp; 15 | sum += temp; 16 | } 17 | cout << sum << endl << n3 << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1099.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int a[1015]; 7 | int main() 8 | { 9 | int n; 10 | int sum = 0, temp = 0, n3; 11 | cin >> n; 12 | for (int i = 1; i <= n; i++) 13 | { 14 | cin >> a[i]; 15 | sum += a[i]; 16 | } 17 | int k; 18 | cin >> k; 19 | cout << sum << endl << a[k] << endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1100.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int num[15015]; 4 | int main() 5 | { 6 | int n; 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | { 10 | scanf("%d", &num[i]); 11 | } 12 | for (int i = n; i >= 1; i--) 13 | { 14 | printf("%d", num[i]); 15 | if (i != 1) printf(" "); 16 | } 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /白马湖OJ/1101.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int a[1000]; 7 | int main() 8 | { 9 | int n; 10 | scanf("%d", &n); 11 | for(int i = 1; i <= n; i++) 12 | { 13 | scanf("%d", &a[i]); 14 | } 15 | i = 1; 16 | while (i <= n) 17 | { 18 | printf("%d ", a[i]); 19 | i += 2; 20 | } 21 | printf("\n"); 22 | i = 2; 23 | while (i <= n) 24 | { 25 | printf("%d ", a[i]); 26 | i += 2; 27 | } 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /白马湖OJ/1101_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[110]; 4 | int main() 5 | { 6 | int n; 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | printf("%d", a[1]); 11 | for (int i = 3; i <= n; i += 2) 12 | printf(" %d", a[i]); 13 | puts(""); 14 | printf("%d", a[2]); 15 | for (int i = 4; i <= n; i += 2) 16 | printf(" %d", a[i]); 17 | puts(""); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1102.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | int a[110]; 10 | scanf("%d", &n); 11 | for (int i = 1; i <= n; i++) 12 | scanf("%d", &a[i]); 13 | int m; 14 | scanf("%d", &m); 15 | int x, y, t; 16 | for (int i = 1; i <= m; i++) 17 | { 18 | scanf("%d%d", &x, &y); 19 | t = a[x]; 20 | a[x] = a[y]; 21 | a[y] = t; 22 | } 23 | printf("%d", a[1]); 24 | for (int i = 2; i <= n; i++) 25 | printf(" %d", a[i]); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /白马湖OJ/1103 智力竞赛.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[11], n, temp; 4 | int main() 5 | { 6 | for (int i = 1; i <= 10; i++) 7 | scanf("%d", &a[i]); 8 | scanf("%d", &n); 9 | for (int i = 1; i <= n; i++) 10 | { 11 | scanf("%d", &temp); 12 | a[temp] += 10; 13 | } 14 | cout << a[1]; 15 | for (int i = 2; i < 11; i++) 16 | cout << " " << a[i]; 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /白马湖OJ/1104 结伴同行去秋游.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | int n, a[maxn]; 5 | int main() 6 | { 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | for (int i = 1; i*2 <= n; i++) 11 | printf("%d %d\n", a[i], a[n-i+1]); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /白马湖OJ/1105 摘苹果.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010; 4 | int a[maxn]; 5 | int main() 6 | { 7 | int n; 8 | scanf("%d", &n); 9 | for (int i = 1; i <= n; i++) 10 | scanf("%d", &a[i]); 11 | int m; 12 | scanf("%d", &m); 13 | m += 30; 14 | int ans = 0; 15 | for (int i = 1; i <= n; i++) 16 | if (m >= a[i]) ans++; 17 | printf("%d", ans); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1106 计算书费.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n; 4 | double a[10] = {28.9, 32.7, 45.6, 78, 35, 86.2, 27.8, 43, 56, 65}; 5 | int main() 6 | { 7 | double ans = 0; 8 | int temp; 9 | for (int i = 0; i < 10; i++) 10 | scanf("%d", &temp), ans += temp * a[i]; 11 | printf("%.1lf", ans); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /白马湖OJ/1107 数组元素的移动.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[110]; 4 | int main() 5 | { 6 | int n; 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | int m, t, j; 11 | scanf("%d", &m); 12 | for (int i = 1; i <= m; i++) 13 | { 14 | scanf("%d", &j); 15 | t = a[j]; 16 | for (int i = j; i <= n-1; i++) 17 | a[i] = a[i+1]; 18 | a[n] = t; 19 | } 20 | printf("%d", a[1]); 21 | for (int i = 2; i <= n; i++) 22 | printf(" %d", a[i]); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /白马湖OJ/1108 数组元素的删除.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[110]; 4 | int main() 5 | { 6 | int n; 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | int m, t, j; 11 | scanf("%d", &m); 12 | for (int i = 1; i <= m; i++) 13 | { 14 | scanf("%d", &j); 15 | t = a[j]; 16 | for (int i = j; i <= n-1; i++) 17 | a[i] = a[i+1]; 18 | } 19 | printf("%d", a[1]); 20 | for (int i = 2; i <= (n - m); i++) 21 | printf(" %d", a[i]); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1109 数组元素的查找.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[110]; 4 | int main() 5 | { 6 | int n; 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | int m, t, k; 11 | bool bo; 12 | scanf("%d", &m); 13 | for (int i = 1; i <= m; i++) 14 | { 15 | scanf("%d", &k); 16 | bo = false; 17 | for (int j = 1; j <= n; j++) 18 | if (a[j] == k) 19 | { 20 | bo = true; 21 | printf("%d\n", j); 22 | break; 23 | } 24 | if (!bo) printf("-1\n"); 25 | } 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /白马湖OJ/1112 数组排序.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[200010]; 4 | int main() 5 | { 6 | int n, t; 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | sort(a+1, a+n+1); 11 | printf("%d", a[1]); 12 | for (int i = 2; i <= n; i++) 13 | printf(" %d", a[i]); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1113 字母统计.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110 + 1000; 4 | int n, cnt[300]; 5 | char str[maxn]; 6 | int main() 7 | { 8 | scanf("%d\n", &n); 9 | gets(str); 10 | for (int i = 0; i < n; i++) 11 | cnt[str[i]]++; 12 | for (int i = 'a'; i <= 'z'; i++) 13 | if (cnt[i] != 0) 14 | { 15 | printf("%c %d\n", i, cnt[i]); 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /白马湖OJ/1115 校门外的树.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | const int maxm = 10010; 5 | int n, m, a, b, cnt = 0, r[maxm]; 6 | int main() { 7 | scanf("%d%d", &m, &n); 8 | for (int i = 0; i <= m; i++) 9 | r[i] = 1; 10 | for (int i = 1; i <= n; i++ ) { 11 | scanf("%d%d", &a, &b); 12 | for (int i = a; i <= b; i++) 13 | r[i] = 0; 14 | } 15 | for (int i = 0; i <= m; i++) { 16 | cnt += r[i]; 17 | } 18 | cout << cnt << endl; 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1116 整数去重.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define read(n) scanf("%d", &n) 3 | using namespace std; 4 | const int maxn = 100010; 5 | int a[maxn], b[maxn]; 6 | int main() 7 | { 8 | int n; 9 | read(n); 10 | for (int i = 1; i <= n; i++) 11 | read(a[i]); 12 | printf("%d", a[1]); b[a[1]] = 1; 13 | for (int i = 1; i <= n; i++) 14 | if (!b[a[i]]) 15 | printf(" %d", a[i]), b[a[i]] = 1; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1117 考试分数中的众数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int num[100010]; 4 | int main() 5 | { 6 | int n; 7 | double a; 8 | scanf("%d", &n); 9 | for (int i = 1; i <= n; i++) 10 | { 11 | scanf("%lf", &a); 12 | num[int(a*1000)]++; 13 | } 14 | int maxx = 0; 15 | for (int i = 0; i <= 100000; i++) 16 | maxx = max(maxx, num[i]); 17 | for (int i = 0; i <= 100000; i++) 18 | if (num[i] == maxx) 19 | printf("%.2lf\n", i / 1000.0); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1118 什么时候开会.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int d[110]; 4 | int main() 5 | { 6 | int n, m, k, a; 7 | cin >> n >> m; 8 | for (int i = 1; i <= n; i++) 9 | { 10 | cin >> k; 11 | for (int j = 1; j <= k; j++) 12 | { 13 | cin >> a; 14 | d[a]++; 15 | } 16 | } 17 | int maxx = m; 18 | for (int i = 1; i <= 100; i++) 19 | if (d[i] > maxx) 20 | maxx = d[i]; 21 | int ans = 0; 22 | for (int i = 1; i <= 100; i++) 23 | if (d[i] == maxx) 24 | { 25 | ans = i; 26 | break; 27 | } 28 | cout << ans << endl; 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /白马湖OJ/1120 英雄卡.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10010; 4 | const int maxm = 100010; 5 | int n, ans, a[maxn], b[maxm]; 6 | int main() 7 | { 8 | cin >> n; 9 | for (int i = 1; i <= n; i++) 10 | scanf("%d", &a[i]), b[a[i]]++; 11 | for (int i = 1; i <= 1e5; i++) 12 | while (b[i] && b[i+1] && b[i+2]) 13 | { 14 | ans++; 15 | b[i]--; 16 | b[i+1]--; 17 | b[i+2]--; 18 | } 19 | cout << ans << endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1121 伙伴.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1121 伙伴.cpp -------------------------------------------------------------------------------- /白马湖OJ/1122.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010; 4 | int n, a[maxn]; 5 | int main() 6 | { 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | sort(a+1, a+n+1); 11 | for (int i = 1; i <= n; i++) 12 | { 13 | printf("%d", a[i]); 14 | if (i != n) printf(" "); 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1123.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010; 4 | int n, a[maxn]; 5 | int main() 6 | { 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | sort(a+1, a+n+1, my_sort); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/1124 图像相似度.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | int n, m, cnt, a[maxn][maxn], b[maxn][maxn]; 5 | int main() 6 | { 7 | cin >> n >> m; 8 | for (int i = 1; i <= n; i++) 9 | for (int j = 1; j <= m; j++) 10 | scanf("%d", &a[i][j]); 11 | for (int i = 1; i <= n; i++) 12 | for (int j = 1; j <= m; j++) 13 | scanf("%d", &b[i][j]); 14 | for (int i = 1; i <= n; i++) 15 | for (int j = 1; j <= m; j++) 16 | if (a[i][j] == b[i][j]) 17 | cnt++; 18 | cout << cnt << endl; 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1125 对角线加法.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | int n, a[maxn][maxn]; 5 | int main() 6 | { 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) 9 | for (int j = 1; j <= n; j++) 10 | scanf("%d", &a[i][j]); 11 | for (int i = 1; i <= n; i++) 12 | a[i][i] += 10, a[i][n+1-i] += 10; 13 | if (n % 2 == 1) a[n/2+1][n/2+1] -= 10; 14 | for (int i = 1; i <= n; i++) 15 | { 16 | for (int j = 1; j <= n; j++) 17 | printf("%5d", a[i][j]); 18 | puts(""); 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1127 杨辉三角.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 20; 4 | int n, a[maxn][maxn]; 5 | int main() 6 | { 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | a[i][1] = 1; 10 | for (int i = 1; i <= n; i++) 11 | { 12 | a[i][i] = 1; 13 | for (int j = 2; j < i; j++) 14 | a[i][j] = a[i-1][j] + a[i-1][j-1]; 15 | for (int j = 1; j <= i; j++) 16 | printf("%5d", a[i][j]); 17 | puts(""); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1135 翻转排序.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100010; 4 | int n, a[maxn], b[maxn]; 5 | int main() { 6 | scanf("%d", &n); 7 | for (int i = 1; i <= n; i++) 8 | scanf("%d", &a[i]), b[i] = a[i]; 9 | sort(b + 1, b + n + 1, sizeof(b)); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /白马湖OJ/1138 排名新规则.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1138 排名新规则.cpp -------------------------------------------------------------------------------- /白马湖OJ/1150.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | char s1[20], s2[20]; 7 | scanf("%s%s", &s1, &s2); 8 | printf("%s %s", s2, s1); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /白马湖OJ/1151.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int i,j=0,k=0; 8 | bool b=false; 9 | char s1[10],s2[10],s[100]; 10 | gets(s); 11 | for(i=0;i 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | char s[1010]; 8 | gets(s); 9 | int k=0; 10 | for (int i=0;i 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | double f; 8 | cin >> f; 9 | char s1[1010],s2[1010]; 10 | scanf("%s%s", s1, s2); 11 | int l = strlen(s1); 12 | int n = 0; 13 | for (int i = 0; i < l; i++) 14 | { 15 | if (s1[i] == s2[i]) n++; 16 | } 17 | double f_real = n * 1.0 / l; 18 | if(f_real >= f) cout << "yes\n"; 19 | else cout << "no\n"; 20 | //cout << n << ' ' << l << ' ' << f << ' ' << f_real; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1157.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | char s[1010]; 8 | scanf("%s", s); 9 | int l = strlen(s); 10 | int n = 0; 11 | for (int i = 0; i < l; i++) 12 | { 13 | if(s[i] == 'A') s[i] = 'T'; 14 | else if(s[i] == 'T') s[i] = 'A'; 15 | else if(s[i] == 'G') s[i] = 'C'; 16 | else if(s[i] == 'C') s[i] = 'G'; 17 | } 18 | puts(s); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1158.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | char s[40]; 8 | char a, b; 9 | scanf("%s %c %c", s, &a, &b); 10 | for (int i = 0; i < strlen(s); i++) 11 | { 12 | if (s[i] == a) s[i] = b; 13 | } 14 | //cout << a << " " << b; 15 | puts(s); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1167.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1167.cpp -------------------------------------------------------------------------------- /白马湖OJ/1168.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | char s[1010], c; 8 | gets(s); 9 | int l = strlen(s); 10 | int ans = 0; 11 | for (int i = 0; i < l; i++) 12 | { 13 | c = s[i]; 14 | if ('1' <= c && c <= '9') 15 | { 16 | ans = ans + c - '0'; 17 | //cout << c << " "; 18 | } 19 | } 20 | cout << ans; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1169 求约数个数【语言基础测试1】.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1169 求约数个数【语言基础测试1】.cpp -------------------------------------------------------------------------------- /白马湖OJ/1169.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | char s[100]; 8 | int k; 9 | scanf("%s%d", s, &k); 10 | int l = strlen(s); 11 | int ans = 0; 12 | char c; 13 | int d; 14 | for (int i = (l - 1); i >= 0; i--) 15 | { 16 | c = s[i]; 17 | d = c - '0'; 18 | ans = ans * k + d; 19 | } 20 | cout << ans; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1170 数列【语言基础测试1】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | long long n, f[maxn]; 5 | int main() 6 | { 7 | cin >> n; 8 | f[1] = 1; 9 | f[2] = 1; 10 | f[3] = 3; 11 | for (int i = 4; i <= n; i++) 12 | f[i] = 2 * (f[i - 1] + f[i - 2]); 13 | cout << f[n]; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1171 装牛奶的桶【语言基础测试1】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int x, y, m, s, ans = 0; 5 | cin >> x >> y >> m; 6 | for (int i = 0; i * x <= m; i++) { 7 | s = i * x + (m - i * x) / y * y; 8 | if (s > ans) ans = s; 9 | } 10 | cout << ans << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /白马湖OJ/1172 数字统计【语言基础测试2】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n, k, ans = 0; 5 | cin >> n; 6 | for (int i = 5; i <= n; i += 5) 7 | for (int j = i; j > 0; j /= 10) 8 | if (j % 10 == 5) { 9 | ans++; 10 | break; 11 | } 12 | cout << ans << endl; 13 | return 0; 14 | } -------------------------------------------------------------------------------- /白马湖OJ/1173 上三角数字三角形【语言基础测试2】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | int n; 5 | int main() { 6 | cin >> n; 7 | int k = 0; 8 | for (int i = 1; i <= n; i++) { 9 | for (int j = 1; j <= n + 1 - i; j++) { 10 | k++; 11 | printf("%4d", k); 12 | } 13 | puts(""); 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /白马湖OJ/1174 计数再现【语言基础测试2】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxm = 3010; 4 | int n, a, b[maxm]; 5 | int main() { 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) { 8 | scanf("%d", &a); 9 | a += 1000; 10 | b[a]++; 11 | } 12 | for (int i = 1; i < 3000; i++) 13 | if (b[i]) printf("%d %d\n", i - 1000, b[i]); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /白马湖OJ/1175 哈弗曼编码【语言基础测试2】.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | multiset < int > s; 4 | multiset < int > ::iterator it; 5 | multiset < int > ::iterator it2; 6 | int n, a, b, x; 7 | int main() { 8 | cin >> n; 9 | for (int i = 1; i <= n; i++) 10 | cin >> x, s.insert(x); 11 | for (int i = 1; i < n; i++) { 12 | a = *s.begin(), s.erase(s.begin()); 13 | b = *s.begin(), s.erase(s.begin()); 14 | printf("%d %d\n", a, b); 15 | s.insert(a + b); 16 | } 17 | return 0; 18 | } -------------------------------------------------------------------------------- /白马湖OJ/1185 加数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, m, ans; 4 | int main() { 5 | cin >> n; 6 | while (n) { 7 | m = n; 8 | while (m) ans++, m /= 10; 9 | n /= 2; 10 | } 11 | cout << ans << endl; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /白马湖OJ/1186 连续数的和.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n, k, ans; 4 | bool check(long long x) { 5 | if (((long long)sqrt(x)) * ((long long)sqrt(x)) == x) return true; 6 | return false; 7 | } 8 | long long calc(long long left, long long right) { 9 | return (left + right) * (right - left + 1) / 2; 10 | } 11 | int main() { 12 | cin >> n >> k; 13 | for (long long i = 1; i + k - 1 <= n; i++) { 14 | if (check(calc(i, i + k - 1))) 15 | ans++; 16 | } 17 | cout << ans << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1187 分数计数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | int n, ans, f[maxn], c[maxn], x[maxn]; 5 | int main() { 6 | cin >> n >> x[1]; 7 | c[x[1]] = f[x[1]] = 1; 8 | for (int i = 2; i <= n; i++) { 9 | x[i] = ((x[i - 1]* 3703 + 1047) % n) + 1; 10 | c[x[i]]++; 11 | for (int j = 1; j <= n; j++) 12 | if (j != x[i]) c[j] = 0; 13 | if (c[x[i]] == 1) f[x[i]] += 1; 14 | else if (c[x[i]] == 2) f[x[i]] += 2; 15 | else f[x[i]] += 3; 16 | ans = max(ans, f[x[i]]); 17 | } 18 | cout << ans << endl; 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1189 加入数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n, m, a[30], t; 4 | int main() { 5 | cin >> t >> m; 6 | while (t) a[++n] = t % 10, t /= 10; 7 | for (int i = n; i > 0; i--) 8 | if (m > a[i]) { 9 | a[i] = m; 10 | break; 11 | } 12 | for (int i = n; i > 0; i--) 13 | printf("%lld", a[i]); 14 | puts(""); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /白马湖OJ/1190 接水问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10010, maxm = 110; 4 | int n, m, a[maxn], b[maxm], ans = -1; 5 | int main() 6 | { 7 | cin >> n >> m; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | int i = 1, k = 1; 11 | while (k <= n) 12 | { 13 | for (int j = 1; j <= m; j++) 14 | if (b[j] < i) 15 | b[j] += a[k++]; 16 | i++; 17 | } 18 | for (int i = 1; i <= m; i++) 19 | if (b[i] > ans) ans = b[i]; 20 | cout << ans; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1199 数数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define read(n) scanf("%d", &n) 3 | using namespace std; 4 | int main() 5 | { 6 | int n, m, ans = 0; 7 | bool flag; 8 | read(n); 9 | for (int i = 4; i <= n; i += 4) 10 | { 11 | flag = false; 12 | m = i; 13 | while (m > 0) 14 | { 15 | if (m % 10 == 3) 16 | { 17 | flag = true; 18 | break; 19 | } 20 | m /= 10; 21 | } 22 | if (flag) ans++; 23 | } 24 | cout << ans; 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /白马湖OJ/1206.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int f(int); 6 | int main() 7 | { 8 | int n; 9 | scanf("%d", &n); 10 | int A = 0, B = 0; 11 | for (int i = 1; i <= n; i++) 12 | { 13 | if (f(i) == 1) A++; 14 | else B++; 15 | } 16 | printf("%d %d", A, B); 17 | } 18 | int f(int n) 19 | { 20 | int a = 0, b = 0; 21 | int t = n; 22 | while (t > 0) 23 | { 24 | if (t % 2 == 1) a ++; 25 | else b ++; 26 | t = t / 2; 27 | } 28 | if (a > b) return 1; 29 | else return 0; 30 | } 31 | -------------------------------------------------------------------------------- /白马湖OJ/1208.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int a[100]; 6 | int main() 7 | { 8 | int n, r; 9 | cin >> n >> r; 10 | int k = 0; 11 | while (n > 0) 12 | { 13 | a[++k] = n % r; 14 | n = n / r; 15 | 16 | } 17 | for (int i = k; i >= 1; i--) 18 | { 19 | cout << a[i]; 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1209.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int k; 4 | int move(int n, char a, char b, char c) 5 | { 6 | if (n == 0) return 0; 7 | move(n - 1, a, c, b); 8 | printf("move %d from %c to %c\n", n, a, c); 9 | k++; 10 | move(n - 1, b, a, c); 11 | return 0; 12 | } 13 | int main() 14 | { 15 | int n; 16 | char a, b, c; 17 | cin >> n; 18 | scanf(" %c %c %c", &a, &b, &c); 19 | ////cout << a << b << c; 20 | move(n, a, b, c); 21 | //cout << k; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1209_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int move(int n, char a, char b, char c) 4 | { 5 | if (n == 0) return 0; 6 | move(n - 1, a, c, b); 7 | printf("move %d from %c to %c\n", n, a, c); 8 | k++; 9 | move(n - 1, b, a, c); 10 | return 0; 11 | } 12 | int main() 13 | { 14 | int n; 15 | char a, b, c; 16 | cin >> n; 17 | scanf(" %c %c %c", &a, &b, &c); 18 | move(n, a, b, c); 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1211.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int s[1020]; 6 | int f(int n) 7 | { 8 | if (s[n] != -1) return s[n]; 9 | int sum = 0; 10 | for (int i = 1; i <= n/2; i++) 11 | { 12 | sum += f(i); 13 | } 14 | s[n] = (sum + 1); 15 | return (sum + 1); 16 | } 17 | int main() 18 | { 19 | memset(s, -1, sizeof(s)); 20 | s[0] = 1; 21 | s[1] = 1; 22 | s[2] = 2; 23 | s[3] = 2; 24 | int n; 25 | cin >> n; 26 | cout << f(n); 27 | return 0; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /白马湖OJ/1212.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int n,m; 6 | int a[100]; 7 | bool f(int k) 8 | { 9 | if (k <= 0) return false; 10 | for (int i = 1; i <= n; i++) 11 | { 12 | if (a[i] == k) return true; 13 | else if (f(a[i] - k) == true) return true; 14 | } 15 | } 16 | int main() 17 | { 18 | cin >> n >> m; 19 | for (int i = 1; i <= n; i++) 20 | { 21 | scanf("%d", a[i]); 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /白马湖OJ/1212_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int n, m; 5 | int a[100]; 6 | int f(int k, int num) 7 | { 8 | if (k == n) 9 | { 10 | if (a[k] == num) return true; 11 | else return false; 12 | } 13 | else 14 | if (f(k + 1, num) || f(k + 1, num - a[k])) return true; 15 | else return false; 16 | } 17 | int main() 18 | { 19 | cin >> n >> m; 20 | for (int i = 1; i <= n; i++) 21 | { 22 | scanf("%d", &a[i]); 23 | } 24 | if (f(1, m)) cout << "YES"; 25 | else cout << "NO"; 26 | } 27 | -------------------------------------------------------------------------------- /白马湖OJ/1214.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | long long a, b; 6 | cin >> a >> b; 7 | a = a % 10007; 8 | long long s = 1; 9 | int k = b; 10 | for (long long i = 1; i <= b/3; i++) 11 | { 12 | s = s * a; 13 | if (s >= 10007) s = s % 10007; 14 | } 15 | while (k > 0) 16 | { 17 | k--; 18 | s = s * a % 10007; 19 | } 20 | cout << s << endl; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1214_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[20000]; 4 | int main() 5 | { 6 | int x, y, sum = 1, ab, temp; 7 | cin >> x >> y; 8 | x = x % 10007; 9 | for(int i = 1; i <= y; i++) 10 | { 11 | sum *= x; 12 | if(sum >= 10007) sum %= 10007; 13 | a[i] = sum; 14 | if(a[i] == a[1]) 15 | if (i != 1) 16 | { 17 | temp = i - 1; 18 | y %= temp; 19 | sum = a[y]; 20 | break; 21 | } 22 | } 23 | printf("%d\n", sum); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /白马湖OJ/1218.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | const int maxn = 100000 + 1 << 3; 6 | const int maxa = 10000; 7 | int n, m, a[maxn]; 8 | bool cheak(int k) 9 | { 10 | 11 | } 12 | int main() 13 | { 14 | scanf("%d%d", &n, &m); 15 | int l = 0, r = 0; 16 | for (int i = 1; i <= n; i++) 17 | scanf("%d", &a[i]), r += a[i]; 18 | int mid; 19 | while (l + 4 < r) 20 | { 21 | mid = (l + r) >> 1; 22 | if (check(mid)) r = mid; 23 | else l = mid; 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /白马湖OJ/1220.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | double s, a, b; 9 | scanf("%lf%lf%lf", &s, &a, &b); 10 | double x=(a+b)*s/(3*a+b); 11 | printf("%.6lf",x/b+(s-x)/a); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /白马湖OJ/1270.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int n; 8 | cin >> n; 9 | long long k = 1; 10 | for (int i = 2; i <= n; i++) 11 | { 12 | k += 1; 13 | k *= 2; 14 | } 15 | cout << k; 16 | //putchar('*'); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /白马湖OJ/1271.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int n; 8 | cin >> n; 9 | int m = n * n; 10 | int k; 11 | if (n % 2 == 1) 12 | { 13 | k = m - (n - 1); 14 | } 15 | else 16 | { 17 | k = m + 1 - n; 18 | } 19 | for (int i = 1; i <= n; i++) 20 | { 21 | printf("%d", k); 22 | k += 2; 23 | if (i != n) printf(" "); 24 | } 25 | //putchar('*'); 26 | return 0; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /白马湖OJ/1272.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #define un unsigned 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | cin >> n; 10 | un long long a = 1, b = 2, t; 11 | if (n == 1) {cout << a; return 0;} 12 | if (n == 2) {cout << b; return 0;} 13 | for (int i = 3; i <= n; i++) 14 | { 15 | t = a; 16 | a = b; 17 | b = b + t; 18 | } 19 | cout << b; 20 | //putchar('*'); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1273.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #define un unsigned 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | cin >> n; 10 | un long long a = 1, b = 1, t; 11 | if (n == 1) {cout << a; return 0;} 12 | if (n == 2) {cout << b; return 0;} 13 | for (int i = 3; i <= n; i++) 14 | { 15 | t = a; 16 | a = b; 17 | b = b + t; 18 | } 19 | cout << b; 20 | //putchar('*'); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1273_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int f(int); 6 | int main() 7 | { 8 | int n; 9 | cin >> n; 10 | cout << f(n); 11 | return 0; 12 | } 13 | int f(int k) 14 | { 15 | if (k == 0) return 0; 16 | else if (k == 1) return 1; 17 | else if (k == 2) return 2; 18 | else if (k == 3) return 3; 19 | else if (k == 4) return 4; 20 | else 21 | { 22 | return (f(k - 1) + f(k - 3)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /白马湖OJ/1273_3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | long fun(int month) 5 | { 6 | if(month == 1) return 1; 7 | else if(month == 2) return 2; 8 | else return fun(month - 1) + fun(month -2); 9 | } 10 | int main() 11 | { 12 | int Mon; 13 | long long Num; 14 | scanf("%d",&Mon); 15 | if (Mon == 5) 16 | { 17 | printf("6"); 18 | return 0; 19 | } 20 | Num = fun(Mon); 21 | printf("%lld",Num); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1274.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | long long f(int); 6 | int main() 7 | { 8 | int n; 9 | cin >> n; 10 | cout << f(n); 11 | return 0; 12 | } 13 | long long f(int k) 14 | { 15 | if (k == 0) return 0; 16 | if (k == 1) return 1; 17 | if (k == 2) return 2; 18 | if (k == 3) return 4; 19 | long long s = 0; 20 | s = f(k - 1) + f(k - 2) + f(k - 3); 21 | return s; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1275.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | long long f(int); 6 | int main() 7 | { 8 | int n; 9 | cin >> n; 10 | cout << f(n); 11 | return 0; 12 | } 13 | long long f(int k) 14 | { 15 | if (k == 0) return 0; 16 | if (k == 1) return 1; 17 | if (k == 2) return 2; 18 | long long s = 0; 19 | s = f(k - 1) + f(k - 2); 20 | return s; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1277.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int n, m; 8 | cin >> n >> m; 9 | int a, b; 10 | long long zfx = 0, cfx = 0; 11 | for (int i = 1; i <=n; i++) 12 | { 13 | for (int ii = i; ii <= n; ii++) 14 | { 15 | for (int j = 1; j <= m; j++) 16 | { 17 | for (int jj = j; jj <= m; jj++) 18 | { 19 | a = ii - i + 1; 20 | b = jj - j + 1; 21 | if (a == b) zfx++; 22 | else cfx++; 23 | } 24 | } 25 | } 26 | } 27 | cout << zfx << " " << cfx; 28 | } 29 | -------------------------------------------------------------------------------- /白马湖OJ/1290.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | char a[256], b[256], c[256]; 6 | using namespace std; 7 | int main() 8 | { 9 | scanf("%s %s", a + 1, b + 1); 10 | int len_a = strlen(a) - 1, len_b = strlen(b), len_c; 11 | if (len_a >= len_b) 12 | { 13 | len_c = len_a; 14 | } 15 | else 16 | { 17 | len_c = len_b; 18 | } 19 | int temp = len_c; 20 | while (temp > 0) 21 | { 22 | temp--; len_a--; len_b--; 23 | 24 | } 25 | return 0; 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /白马湖OJ/1292.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1292.cpp -------------------------------------------------------------------------------- /白马湖OJ/1293 连加.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | unsigned long long n; 6 | cin >> n; 7 | printf("%lld", (n) * (n + 1) / 2); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /白马湖OJ/1293.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main() 5 | { 6 | int a = 2147483647, b = 2147483648, c = -2147483649; 7 | long long d = a / 2 * a; 8 | printf("%d\n%d\n%d\n%lld\n", a, b, c, d); 9 | } 10 | -------------------------------------------------------------------------------- /白马湖OJ/1294.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1294.cpp -------------------------------------------------------------------------------- /白马湖OJ/1294_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | unsigned long long n; 9 | cin >> n; 10 | printf("%lld", (n) * (n + 1) / 2); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/1297.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int a, b; 9 | scanf("%d%d", &a, &b); 10 | printf("%d/%d=%d.", a, b, (a / b)); 11 | a = a % b; 12 | for (int i = 1; i <= 20; i++) 13 | { 14 | if (i != 1 && a == 0) break; 15 | a *= 10; 16 | printf("%d", (a / b)); 17 | a = a % b; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1300.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | long long f(long long a, long long b) 7 | { 8 | return b==0?a:f(b,a%b); 9 | } 10 | int main() 11 | { 12 | int n; 13 | scanf("%d", &n); 14 | int i = 1; 15 | while (i * i <= n) 16 | { 17 | i++; 18 | } 19 | i--; 20 | printf("%d", i); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1303_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | int n, p, a, i, s; 9 | scanf("%d", &n); 10 | for (int _i = 1; _i <= n; i++) 11 | { 12 | scanf("%d", &p); 13 | s = 1; i = 1; 14 | while (s % p != 0) 15 | { 16 | s = (s * i) % p; 17 | i++; 18 | } 19 | a = i; 20 | printf("%d\n", a); 21 | } 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1305_3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int a, b; 9 | long long ans, ansa = 0, ansb = 0; 10 | scanf("%d%d", &a, &b); 11 | for (int i = 1; i <= b; i++) ansa += b / i; 12 | for (int i = 1; i <= (a - 1); i++) ansb += (a - 1) / i; 13 | ans = ansa - ansb; 14 | printf("%d", ans); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /白马湖OJ/1306.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | long long x, y, s, ans = 0, i, j; 7 | long long GCD(long long a, long long b) 8 | { 9 | return b==0?a:GCD(b,a%b); 10 | } 11 | int main() 12 | { 13 | scanf("%d%d", &x, &y); 14 | s = x * y; 15 | for (i = x; i <= y; i++) 16 | { 17 | if (s % i != 0) continue; 18 | j = s / i; 19 | if (GCD(i, j) == x) 20 | { 21 | ans++; 22 | //printf("%lld %lld\n", i, j); 23 | } 24 | } 25 | printf("%lld", ans); 26 | } 27 | -------------------------------------------------------------------------------- /白马湖OJ/1310.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1310.cpp -------------------------------------------------------------------------------- /白马湖OJ/1330.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int k[10000]; 4 | int main() 5 | { 6 | long long n, m, max = -1, sum = 0; 7 | cin >> n>> m; 8 | for (int i = 1; i <= n; i++) 9 | { 10 | max = -1; 11 | for (int j = 1; j <= m ;j++) 12 | { 13 | scanf("%d", &k[j]); 14 | if (k[j] > max) max = k[j]; 15 | } 16 | sum += max; 17 | } 18 | printf("%lld", sum); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1331.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | char k[100009]; 7 | bool mark[100009]; 8 | int main() 9 | { 10 | int n, m; 11 | int min; 12 | scanf("%d%d%*c", &n, &m); 13 | for (int i = 1; i <= n; i++) 14 | scanf("%c", &k[i]); 15 | int _m = m; 16 | for (int i = 1; i <= n; i++) 17 | { 18 | 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1331_12.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | string a[100]; 4 | void change(string &a, string &b) 5 | { 6 | string t = a; a = b; b = t; 7 | } 8 | int main() 9 | { 10 | int n; 11 | scanf("%d\n", &n); 12 | for (int i = 1; i <= n; i++) 13 | cin >> a[i]; 14 | for (int i = 1; i < n; i++) 15 | { 16 | for (int j = (i+1); j <= n; j++) 17 | { 18 | if ((a[i] + a[j]) <= (a[j] + a[i])) 19 | { 20 | change(a[i], a[j]); 21 | } 22 | } 23 | } 24 | for (int i = 1; i <= n; i++) 25 | { 26 | cout << a[i]; 27 | } 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /白马湖OJ/1332.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | char k[100009]; 7 | bool mark[100009]; 8 | int main() 9 | { 10 | int n, m; 11 | int min; 12 | scanf("%d%d%*c", &n, &m); 13 | for (int i = 1; i <= n; i++) 14 | scanf("%c", &k[i]); 15 | int _m = m; 16 | for (int i = 1; i <= n; i++) 17 | { 18 | 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1332_12.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | const int N = 20015; 7 | char a[N]; 8 | int main() 9 | { 10 | int n, m; 11 | scanf("%d%d\n", &n, &m); 12 | char ch; 13 | scanf("%s", a); 14 | int i; 15 | for (int k = 1; k <= m; k++) 16 | { 17 | i = 0; 18 | while(i < strlen(a) && a[i] < a[i+1]) i++; 19 | for(int j = i; j < strlen(a); j++) a[j] = a[j+1]; 20 | } 21 | printf("%s", a); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1332_13.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | const int N = 20015; 7 | char a[N]; 8 | bool b[N]; 9 | int main() 10 | { 11 | int n, m; 12 | scanf("%d%d\n", &n, &m); 13 | char ch; 14 | scanf("%s", a + 1); 15 | int l = strlen(a), i; 16 | for (int k = 1; k <= m; k++) 17 | { 18 | i = 0; 19 | while(i <= l && a[i] < a[i+1]) i++; 20 | for(int j = i; j <= l; j++) a[j] = a[j+1]; 21 | } 22 | for (int i = 1; i <= l; i++) 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /白马湖OJ/1338.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int m, t, u, f, d; 6 | char c; 7 | scanf("%d%d%d%d%d\n", &m, &t, &u, &f, &d); 8 | int ans = -1, time = 0; 9 | for (int i = 1;i <=t; i++) 10 | { 11 | scanf("%c%*c", &c); 12 | if (c == 'u' || c =='d') time+= u + d; 13 | else if (c == 'f') time += f + f; 14 | if (time > m && ans == -1) ans = i - 1; 15 | } 16 | if (ans == -1) ans = t; 17 | printf("%d", ans); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1401.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1401.cpp -------------------------------------------------------------------------------- /白马湖OJ/1402_4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1402_4.cpp -------------------------------------------------------------------------------- /白马湖OJ/1402_7.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1402_7.cpp -------------------------------------------------------------------------------- /白马湖OJ/1403.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1403.cpp -------------------------------------------------------------------------------- /白马湖OJ/1404.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1404.cpp -------------------------------------------------------------------------------- /白马湖OJ/1406.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1406.cpp -------------------------------------------------------------------------------- /白马湖OJ/1412_12.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1412_12.cpp -------------------------------------------------------------------------------- /白马湖OJ/1412_13.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1412_13.cpp -------------------------------------------------------------------------------- /白马湖OJ/1413_23.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1413_23.cpp -------------------------------------------------------------------------------- /白马湖OJ/1413_24.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1413_24.cpp -------------------------------------------------------------------------------- /白马湖OJ/1413_25.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1413_25.cpp -------------------------------------------------------------------------------- /白马湖OJ/1413_26.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1413_26.cpp -------------------------------------------------------------------------------- /白马湖OJ/1413_27.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1413_27.cpp -------------------------------------------------------------------------------- /白马湖OJ/1413_45.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1413_45.cpp -------------------------------------------------------------------------------- /白马湖OJ/1414.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1414.cpp -------------------------------------------------------------------------------- /白马湖OJ/1419.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1419.cpp -------------------------------------------------------------------------------- /白马湖OJ/1419_2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1419_2.cpp -------------------------------------------------------------------------------- /白马湖OJ/1420_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int num[20]; 7 | int main() 8 | { 9 | int n, sum; 10 | scanf("%d", &n); 11 | num[0] = 1; 12 | num[1] = 1; 13 | for (int i = 2; i <= n; i++) 14 | { 15 | sum = 0; 16 | for (int j = 0; j <= i - 1; j++) 17 | sum += num[j] * num[i-j-1]; 18 | num[i] = sum; 19 | } 20 | printf("%d", num[n]); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /白马湖OJ/1421.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1421.cpp -------------------------------------------------------------------------------- /白马湖OJ/1421_12.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1421_12.cpp -------------------------------------------------------------------------------- /白马湖OJ/1421_2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1421_2.cpp -------------------------------------------------------------------------------- /白马湖OJ/1422.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | -------------------------------------------------------------------------------- /白马湖OJ/1425.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1425.cpp -------------------------------------------------------------------------------- /白马湖OJ/1426.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1426.cpp -------------------------------------------------------------------------------- /白马湖OJ/1427.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int f(int n); 7 | int main() 8 | { 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /白马湖OJ/1429.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1429.cpp -------------------------------------------------------------------------------- /白马湖OJ/1429_12.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1429_12.cpp -------------------------------------------------------------------------------- /白马湖OJ/1430.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1430.cpp -------------------------------------------------------------------------------- /白马湖OJ/1430_12.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1430_12.cpp -------------------------------------------------------------------------------- /白马湖OJ/1430_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int n, sum = 0, a[21], used[21], f[10010], s[10010][22]; 7 | int main() 8 | { 9 | scanf("%d", &n); 10 | for (int i = 1; i <= n; i++) 11 | scanf("%d", &a[i]), sum += a[i]; 12 | each = sum / 4; 13 | 14 | memset(f, 0, sizeof(f)); 15 | memset 16 | int f 17 | for () 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1440 图灵机游戏.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100010; 4 | int n, a[maxn]; 5 | int ans_dfs = -1, ans_bfs; 6 | void DFS(int i, int k) { 7 | if (k >= ans_dfs && ans_dfs != -1) return ; 8 | if (i == n) { 9 | ans_dfs = k; 10 | return ; 11 | } 12 | DFS(a[i], k + 1); 13 | a[i]++; 14 | DFS(i, k + 1); 15 | a[i]--; 16 | } 17 | int main() { 18 | scanf("%d", &n); 19 | for (int i = 1; i <= n; i++) 20 | scanf("%d", &a[i]); 21 | DFS(1, 0); 22 | cout << ans_dfs << endl; 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /白马湖OJ/1507 简单问题.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1507 简单问题.cpp -------------------------------------------------------------------------------- /白马湖OJ/1510【代码能力提升套题3】幻方.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1510【代码能力提升套题3】幻方.xlsx -------------------------------------------------------------------------------- /白马湖OJ/1511 【代码能力提升套题3】表达式的转换.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | stack < int > n; 4 | stack < char > s; 5 | int main() { 6 | char c; 7 | while (scanf("%c", &c) != EOF) { 8 | if ('0' <= c && c <= '9') { 9 | n.push(c - '0'); 10 | } else if (c == '-' || c == '+') { 11 | s.push(c); 12 | } 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1600.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | long long a[1015][1015]; 6 | int main() 7 | { 8 | int n; 9 | cin >> n; 10 | for (int i = 1; i <= n; i++) 11 | { 12 | for (int j = 1; j <= i; j++) 13 | { 14 | cin >> a[i][j]; 15 | } 16 | } 17 | for (int i = (n - 1); i >= 1; i--) 18 | { 19 | for (int j = 1; j <= i; j++) 20 | { 21 | if (a[i + 1][j] > a[i + 1][j + 1]) a[i][j] += a[i + 1][j]; 22 | else a[i][j] += a[i + 1][j + 1]; 23 | } 24 | } 25 | cout << a[1][1]; 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /白马湖OJ/1600_12.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long a[2][1015]; 4 | int main() 5 | { 6 | int n; 7 | scanf("%d", &n); 8 | bool flag = true; 9 | scanf("%d", &a[flag][1]); 10 | for (int i = 1; i <= n; i++) 11 | { 12 | for (int j = 1; j <= i; j++) 13 | scanf("%d", &a[flag][j]); 14 | for (int j = 1; j <= i; j++) 15 | a[flag][j] += max(a[!flag) 16 | flag = !flag; 17 | } 18 | int maxx = -1; 19 | for (int i = 1; i <= n; i++) 20 | if (maxx < a[!flag][j]) max = a[!flag][j]; 21 | printf("%d", maxx); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1601.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int maxn = 1010; 5 | int a[maxn], b[maxn]; 6 | int main() 7 | { 8 | int n; 9 | scanf("%d", &n); 10 | for (int i = 1; i <= n; i++) 11 | { 12 | scanf("%d", &a[i]); 13 | b[i] = 1; 14 | for (int j = 1; j < i; j++) 15 | { 16 | if (a[j] < a[i]) 17 | { 18 | if (b[j] + 1 > b[i]) b[i] = b[j] + 1; 19 | } 20 | } 21 | } 22 | int max = b[1]; 23 | for (int i = 1; i <= n; i++) 24 | { 25 | if (b[i] > max) max = b[i]; 26 | } 27 | cout << max << endl; 28 | return 0; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /白马湖OJ/1601_12.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define scnaf scanf 3 | const int maxn = 110; 4 | int a[maxn], b[maxn]; 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | scnaf("%d", &n); 10 | for (int i = 1; i <= n; i++) 11 | scnaf("%d", &a[i]); 12 | int k = 1; 13 | b[1]= a[1]; 14 | for(int i = 2; i <= n; i++) 15 | { 16 | if(a[i]> b[k]) 17 | { 18 | b[++k]= a[i]; 19 | } 20 | else 21 | { 22 | char*pos = lower_bound(b, b + k, a[i]); 23 | *pos= a[i]; 24 | } 25 | } 26 | printf("%d\n",k); 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /白马湖OJ/1601_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | int a[maxn], f[maxn]; 5 | int main() 6 | { 7 | int n; 8 | scanf("%d", &n); 9 | for (int i = 1; i <= n; i++) 10 | scanf("%d", &a[i]); 11 | f[1] = 1; 12 | for (int i = 2; i <= n; i++) 13 | { 14 | if (a[i] > a[i-1]) 15 | f[i] = f[i-1] + 1; 16 | else 17 | f[i] = 1; 18 | int max = f[1]; 19 | for (int i = 2; i <= n; i++) 20 | if (f[i] > max) max = f[i]; 21 | printf("%d", max); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1602_12.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | -------------------------------------------------------------------------------- /白马湖OJ/1603.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 20010, maxm = 40; 4 | int a[maxm], f[maxn]; 5 | int main() 6 | { 7 | memset(f, 0, sizeof(f)); 8 | int n, m; 9 | scanf("%d%d", &n, &m); 10 | for (int i = 1; i <= m; i++) 11 | scanf("%d", &a[i]); 12 | f[0] = 1; 13 | for (int i = 1; i <= m; i++) 14 | for (int j = n; j >= a[i]; j--) 15 | if (f[j-a[i]]) f[j] = 1; 16 | int i = n+1; 17 | while (--i) 18 | if (f[i]) 19 | printf("%d", n-i), return 0; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1605.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int n, m, a, f[500010]; 7 | int main() 8 | { 9 | int sum = 0; 10 | scanf("%d", &n); 11 | f[0] = 1; 12 | for (int i = 1; i <= n; i++) 13 | { 14 | scanf("%d", &a); 15 | sum += a; 16 | for (int j = sum; j >= a; j--) 17 | f[j] |= f[j - a]; 18 | } 19 | for (int i = sum/2; i >= 0; i--) 20 | if (f[i]) 21 | { 22 | printf("%d", (sum - i*2)); 23 | return 0; 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /白马湖OJ/1607.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 510, maxk = 100010; 4 | int f[maxk]; 5 | int main() 6 | { 7 | int k, n, t, p, sum_p = 0; 8 | scanf("%d%d", &k, &n); 9 | for (int i = 1; i <= n; i++) 10 | { 11 | scanf("%d%d", &t, &p); 12 | sum_p += p; 13 | for (int j = k; j >= t; j--) 14 | f[j] = max(f[j], f[j-t] + p); 15 | } 16 | printf("%d", sum_p - f[k]); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /白马湖OJ/1608.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main() 7 | { 8 | int n; 9 | scanf("%d", &n); 10 | for (int i = 1; i <= n; i++) 11 | scanf("%d"., ) 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /白马湖OJ/1609.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | const int maxn = 400; 7 | int f[maxn][maxn]; 8 | int main() 9 | { 10 | int G, V, n, t, g, v; 11 | scanf("%d%d%d", &G, &V, &n); 12 | for (int i = 1; i <= n; i++) 13 | { 14 | scanf("%d%d%d", &t, &g, &v); 15 | for (int j = G; j >= g; j--) 16 | for (int jj = V; jj >= v; jj--) 17 | f[j][jj] = max(f[j][jj], f[j-g][jj-v] + t); 18 | } 19 | printf("%d", f[G][V]); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1610.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100010; 4 | int f[maxn]; 5 | int minn(int a, int b) 6 | { 7 | int min_n = min(a, b); 8 | if (min_n == 0) return max(a, b); 9 | else return min_n; 10 | } 11 | int main() 12 | { 13 | int n, v, a; 14 | scanf("%d%d", &v, &n); 15 | for (int i = 1; i <= n; i++) 16 | { 17 | scanf("%d", &a); 18 | for (int j = a; j <= v; j++) 19 | f[j] = minn(f[j], f[j-a] + 1); 20 | } 21 | printf("%d", f[v]); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1611_23.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1611_23.cpp -------------------------------------------------------------------------------- /白马湖OJ/1611_34.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1611_34.cpp -------------------------------------------------------------------------------- /白马湖OJ/1611_45.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 310; 4 | int f[maxn][maxn], a[maxn][maxn]; 5 | int main() 6 | { 7 | int n, m; 8 | scanf("%d%d", &n, &m); 9 | for (int i = 1; i <= n; i++) 10 | for (int j = 1; j <= n; j++) 11 | scanf("%d", &a[i][j]); 12 | f[0][0] = 0; 13 | for (int i = 1; i <= n; i++) 14 | { 15 | for (int j = 1; j <= m; j+) 16 | { 17 | a[i][j] = max(a[i-1][j], a[) 18 | } 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1615 加分二叉树.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 40; 4 | int n, a[maxn]; 5 | int main() 6 | { 7 | scanf("%d", &n); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/1617 数字游戏【动态规划 DP专题训练】.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1617 数字游戏【动态规划 DP专题训练】.cpp -------------------------------------------------------------------------------- /白马湖OJ/1621 1的最优操作序列.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10010; 4 | int n, f[maxn]; 5 | int main() { 6 | cin >> n; 7 | f[1] = 1; 8 | for (int i = 2; i <= n; i++) { 9 | for (int j = 1; j <= i; j++) 10 | f[i] = max(f[i], f[j] * f[i - j] + 1); 11 | } 12 | cout << f[n]; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /白马湖OJ/1625 统计正方形和长方形个数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n, m; 6 | scanf("%d,%d", &n, &m); 7 | if (n > m) swap(n, m); 8 | long long zfx, cfx; 9 | if (n == 1) 10 | { 11 | zfx = m; 12 | cfx = m * (m+1) / 2 - zfx; 13 | } 14 | else 15 | { 16 | zfx = 0; 17 | for (int i = 1; i <= n; i++) 18 | zfx += (n - i + 1) * (m - i + 1); 19 | cfx = n * m; cfx /= 4; cfx *= (n+1) * (m+1); cfx -= zfx; 20 | } 21 | printf("%lld,%lld", zfx, cfx); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1631 拦截导弹.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1631 拦截导弹.cpp -------------------------------------------------------------------------------- /白马湖OJ/1647 邮局.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 310; 4 | const int maxm = 40; 5 | int n, m, a[maxn]; 6 | int main() { 7 | cin >> n >> m; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | for (int i = 1; i <= n; i++) { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /白马湖OJ/1656 货币系统.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 30, maxm = 10010; 4 | int n, m, a[maxn]; 5 | long long f[maxm]; 6 | int main() { 7 | scanf("%d%d", &n, &m); 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | f[0] = 1; 11 | for (int i = 1; i <= n; i++) 12 | for (int j = a[i]; j <= m; j++) 13 | f[j] += f[j - a[i]]; 14 | printf("%lld", f[m]); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /白马湖OJ/1657 竞赛总分.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10010; 4 | int n, m, f[maxn], t[maxn], v[maxn]; 5 | int main() { 6 | scanf("%d%d", &m, &n); 7 | for (int i = 1; i <= n; i++) { 8 | scanf("%d%d", &v[i], &t[i]); 9 | for (int j = t[i]; j <= m; j++) 10 | f[j] = max(f[j - t[i]] + v[i], f[j]); 11 | } 12 | printf("%d\n", f[m]); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /白马湖OJ/1658 质数和分解.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxm = 210; 4 | int a[47] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199}; 5 | int n = 46, m; 6 | long long f[maxm]; 7 | int main() { 8 | scanf("%d", &m); 9 | f[0] = 1; 10 | for (int i = 1; i <= n; i++) { 11 | for (int j = a[i]; j <= m; j++) 12 | f[j] += f[j - a[i]]; 13 | } 14 | printf("%lld", f[m]); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /白马湖OJ/1659 最小乘车费用.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n = 10, a[11], m, f[110]; 4 | int main() { 5 | memset(f, 63, sizeof(f)); 6 | for (int i = 1; i <= n; i++) 7 | scanf("%d", &a[i]); 8 | scanf("%d", &m); 9 | f[0] = 0; 10 | for (int i = 1; i <= n; i++) 11 | for (int j = i; j <= m; j++) 12 | f[j] = min(f[j], f[j - i] + a[i]); 13 | printf("%d", f[m]); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /白马湖OJ/1702 [USACO 1.1.3]黑色星期五.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1702 [USACO 1.1.3]黑色星期五.cpp -------------------------------------------------------------------------------- /白马湖OJ/1703.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1703.cpp -------------------------------------------------------------------------------- /白马湖OJ/1720 [USACO 1.5.4]跳棋的挑战.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1720 [USACO 1.5.4]跳棋的挑战.cpp -------------------------------------------------------------------------------- /白马湖OJ/1724.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1724.cpp -------------------------------------------------------------------------------- /白马湖OJ/1724_2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1724_2.cpp -------------------------------------------------------------------------------- /白马湖OJ/1724_3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1724_3.cpp -------------------------------------------------------------------------------- /白马湖OJ/1725.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1725.cpp -------------------------------------------------------------------------------- /白马湖OJ/1733.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int a[39], f[30][10010]; 7 | int main() 8 | { 9 | int n, m; 10 | scanf("%d%d", &n, &m); 11 | for (int i = 1; i <= n; i++) 12 | scanf("%d", &a[i]); 13 | for (int i = 1; i <= n; i++) 14 | { 15 | for (int j = 1; j <= m; j++) 16 | { 17 | f[i][j] = f[i-1][j]; 18 | if (j > a[i]) f[i][j] += f[i][j-a[i]]; 19 | } 20 | } 21 | printf("%d", f[n][m]); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1733_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | long long f[10001]; 7 | int main() 8 | { 9 | int n, m, k; 10 | scanf("%d%d", &n, &m); 11 | f[0] = 1; 12 | for (int i = 1; i <= n; i++) 13 | { 14 | scanf("%d", &k); 15 | for (int j = k; j <= m; j++) 16 | f[j] += f[j-k]; 17 | } 18 | printf("%lld", f[m]); 19 | return 0; 20 | } 21 | 22 | 23 | -------------------------------------------------------------------------------- /白马湖OJ/1739 [USACO 2.4.5]分数化小数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010; 4 | int n, m, t; 5 | vector < int > a, b, c, O; 6 | int main() { 7 | cin >> n >> m; 8 | if (n > m) { 9 | t = n / m; 10 | while (t > 0) { 11 | a.push_back(t % 10); 12 | t /= 10; 13 | } 14 | } else a.push_back(0); 15 | while (1) { 16 | n = n * 10; 17 | b,push_back() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/1746 [USACO 3.2.1]阶乘.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxl = 20000; 4 | int main() { 5 | int n, l = 0, s[maxl]; 6 | memset(s, 0, sizeof(s)); 7 | s[1] = l = 1; 8 | cin >> n; 9 | for (int i = 1; i <= n; i++) { 10 | for (int j = l; j > 0; j--) { 11 | s[j] *= i; 12 | s[j + 1] += s[j] / 10000; 13 | s[j] %= 10000; 14 | } 15 | while (s[l + 1]) l++; 16 | } 17 | int k = 1; 18 | while (!s[k]) k++; 19 | while (s[k] % 10 == 0) s[k] /= 10; 20 | cout << s[k] % 10 << endl; 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /白马湖OJ/1800 NOIP2009 多项式输出.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n, tmp; 6 | scanf("%d", &n); 7 | for (int i = n; i >= 0; i--) 8 | { 9 | scanf("%d", &tmp); 10 | if (tmp == 0) continue; 11 | if (tmp > 0 && i != n) printf("+"); 12 | if (tmp == -1 && i != 0) printf("-"); 13 | else if (tmp != 1 || i == 0) printf("%d", tmp); 14 | if (i == 1) printf("x"); 15 | else if (i != 0) printf("x^%d", i); 16 | } 17 | puts(""); 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /白马湖OJ/1804 【NOIP2010 普及组】数字统计.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, m, k; 4 | long long cnt = 0; 5 | int main() { 6 | cin >> n >> m; 7 | for (int i = n; i <= m; i++) { 8 | for (int t = i; t > 0; t /= 10) { 9 | k = t % 10; 10 | if (k == 2) cnt++; 11 | } 12 | } 13 | cout << cnt; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1806 NOIP2010 导弹拦截.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | const int maxn = 100000 + (1 << 3); 8 | int a[maxn]; 9 | int n, x1, y1, x2, y2; 10 | int main() 11 | { 12 | scanf("%d%d%d%d%d", &x1, &y1, &x2, &y2, &n); 13 | for (int i = 1; i <= n; i++) 14 | scanf("%d", &a[i]); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1812 【NOIP2012 普及组】质因数分解.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, m; 4 | bool is_prime(int n) { 5 | for (int i = 2; i <= sqrt(n); i++) { 6 | if (n % i == 0) return false; 7 | } 8 | return true; 9 | } 10 | int main() { 11 | cin >> n; 12 | for (int i = n; i >= 2; i--) { 13 | if (n % i == 0) { 14 | if (is_prime(i)) { 15 | cout << i << endl; 16 | return 0; 17 | } 18 | } 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1816 【NOIP2013 普及组】计数问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, x, k; 4 | long long cnt = 0; 5 | int main() { 6 | cin >> n >> x; 7 | for (int i = 1; i <= n; i++) { 8 | for (int t = i; t > 0; t /= 10) { 9 | k = t % 10; 10 | if (k == x) cnt++; 11 | } 12 | } 13 | cout << cnt; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1817 【NOIP2013 普及组】表达式求值.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 100000 + 100000; 4 | struct Num { 5 | int len = 0; 6 | int a[maxn]; 7 | inline void pop(int n) { 8 | a[++len] = n; 9 | } 10 | inline int push() { 11 | return a[len--]; 12 | } 13 | }; 14 | struct Cal { 15 | int len = 0; 16 | char a[maxn]; 17 | inline void pop(char n) { 18 | a[++len] = n; 19 | } 20 | inline char push() { 21 | return a[len--]; 22 | } 23 | }; 24 | int main() 25 | { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /白马湖OJ/1820 【NOIP2014 普及组】珠心算测验.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | const int maxm = 20010; 5 | int n, a[maxn], b[maxm]; 6 | int main() { 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) scanf("%d", &a[i]); 9 | for (int i = 1; i < n; i++) 10 | for (int j = i + 1; j <= n; j++) 11 | b[a[i] + a[j]]++; 12 | long long ans = 0; 13 | for (int i = 1; i <= 20000; i++) 14 | ans += b[i] * (b[i] - 1); 15 | cout << ans << endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1821 【NOIP2014 普及组】比例简化.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a, b, n, m, l, ans_a, ans_b; 4 | double x, ans_c; 5 | int main() { 6 | cin >> n >> m >> l; 7 | ans_c = n + m; 8 | for (int i = 1; i <= l; i++) { 9 | a = i, b = i * m / n; 10 | if (b > l) b = l; 11 | x = (a / (double)b) - (n / (double)m); 12 | // cout << x << endl; 13 | if (x >= 0 && x < ans_c) { 14 | ans_a = a; 15 | ans_b = b; 16 | ans_c = x; 17 | } 18 | } 19 | cout << ans_a << " " << ans_b << endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1824 【NOIP2015 普及组】金币.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10010; 4 | int n, f[maxn]; 5 | long long ans = 0; 6 | int main() 7 | { 8 | cin >> n; 9 | int i = 1, k = 0; 10 | while (k <= n) { 11 | for (int j = 1; j <= i; j++) f[++k] = i; 12 | i++; 13 | } 14 | ans = 0; 15 | for (int i = 1; i <= n; i++) { 16 | ans += f[i]; 17 | } 18 | cout << ans; 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/1833 【NOIP2008 普及组】排座椅.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1833 【NOIP2008 普及组】排座椅.cpp -------------------------------------------------------------------------------- /白马湖OJ/1840 【NOIP2006 普及组】明明的随机数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010; 4 | int a[maxn]; 5 | int main() 6 | { 7 | int n, t; 8 | cin >> n; 9 | int m = n; 10 | for (int i = 1; i <= n; i++) 11 | { 12 | cin >> t; 13 | if (a[t]) m--; 14 | a[t] = 1; 15 | } 16 | cout << m << endl; 17 | int j; 18 | for (int i = 0; i <= 1000; i++) 19 | if (a[i]) 20 | { 21 | printf("%d", i); 22 | j = i; 23 | break; 24 | } 25 | for (int i = j+1; i <= 1000; i++) 26 | if (a[i]) printf(" %d", i); 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /白马湖OJ/1841 【NOIP2006 普及组】开心的金明.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 30; 4 | const int maxm = 30010; 5 | int a[maxn], v[maxn], f[maxm]; 6 | int main() 7 | { 8 | int n, m; 9 | scanf("%d%d", &m, &n); 10 | for (int i = 1; i <= n; i++) 11 | scanf("%d%d", &v[i], &a[i]), 12 | a[i] *= v[i]; 13 | f[0] = 0; 14 | for (int i = 1; i <= n; i++) 15 | for (int j = m; j >= v[i]; j--) 16 | f[j] = max(f[j], f[j-v[i]] + a[i]); 17 | int maxx = -1; 18 | for (int i = 1; i <= m; i++) 19 | maxx = max(maxx, f[i]); 20 | cout << maxx << endl; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1844 【NOIP2005 普及组】陶陶摘苹果.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a[11]; 4 | int main() 5 | { 6 | int n; 7 | for (int i=1;i<=10;i++) scanf("%d",&a[i]); 8 | scanf("%d",&n); 9 | n+=30; 10 | int s=0; 11 | for (int i=1;i<=10;i++) 12 | { 13 | if (n>=a[i]) s++; 14 | } 15 | printf("%d",s); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/1845 【NOIP2005 普及组】校门外的树.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxm = 10010; 4 | int n, m, l, r, a[maxm]; 5 | int main() { 6 | cin >> m >> n; 7 | for (int i = 1; i <= n; i++) { 8 | scanf("%d%d", &l, &r); 9 | for (int i = l; i <= r; i++) 10 | a[i] = 1; 11 | } 12 | int ans = 0; 13 | for (int i = 0; i <= m; i++) 14 | if (!a[i]) ans++; 15 | cout << ans << endl; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /白马湖OJ/1846 【NOIP2005 普及组】采药.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | const int maxm = 1010; 5 | int n, m, a[maxn], v[maxn], f[maxm]; 6 | int main() { 7 | cin >> m >> n; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d%d", &a[i], &v[i]); 10 | f[0] = 0; 11 | for (int i = 1; i <= n; i++) 12 | for (int j = m; j >= a[i]; j--) 13 | f[j] = max(f[j], f[j - a[i]] + v[i]); 14 | cout << f[m] << endl; 15 | return 0; 16 | } -------------------------------------------------------------------------------- /白马湖OJ/1848 【NOIP2004 普及组】不高兴的津津.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1848 【NOIP2004 普及组】不高兴的津津.cpp -------------------------------------------------------------------------------- /白马湖OJ/1854 【NOIP2003 普及组】栈.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 20; 4 | long long n, f[maxn]; 5 | int main() { 6 | cin >> n; 7 | f[0] = f[1] = 1; 8 | for (int i = 2; i <= n; i++) 9 | for (int j = 0; j < i; j++) 10 | f[i] += f[j] * f[i - j - 1]; 11 | cout << f[n]; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /白马湖OJ/1861 【2013年宁波赛】分数统计.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 10000; 4 | int n, m, f[maxn]; 5 | int find(int x) { 6 | if (f[x] == x) return x; 7 | else return f[x] = find(f[x]); 8 | } 9 | int main() { 10 | scanf("%d%d", &n, &m); 11 | for (int i = 1; i <= n; i++) 12 | for (int i = 1; i <= m; i++) { 13 | scanf("%d%d", &x, &y); 14 | f[find(x)] = find(y); 15 | } 16 | for (int i = 1; i <= n; i++) 17 | cnt[find(i)]++; 18 | int maxn = 0, maxi; 19 | for (int i = 1;) 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1863 【NOIP2001 普及组】装箱问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 50; 4 | const int maxm = 20010; 5 | int n, m, a[maxn], f[maxm]; 6 | int main() { 7 | cin >> m >> n; 8 | for (int i = 1; i <= n; i++) 9 | scanf("%d", &a[i]); 10 | f[0] = 1; 11 | for (int i = 1; i <= n; i++) { 12 | for (int j = m; j >= a[i]; j--) 13 | f[j] |= f[j - a[i]]; 14 | } 15 | for (int i = m; i >= 0; i--) 16 | if (f[i]) { 17 | cout << m - i << endl; 18 | return 0; 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /白马湖OJ/1902.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1902.cpp -------------------------------------------------------------------------------- /白马湖OJ/1902_2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1902_2.cpp -------------------------------------------------------------------------------- /白马湖OJ/1902_3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1902_3.cpp -------------------------------------------------------------------------------- /白马湖OJ/1902_4.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1902_4.cpp -------------------------------------------------------------------------------- /白马湖OJ/1902_5.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1902_5.cpp -------------------------------------------------------------------------------- /白马湖OJ/1920 【NOIP模拟赛A06】检查员.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1920 【NOIP模拟赛A06】检查员.cpp -------------------------------------------------------------------------------- /白马湖OJ/1927 【NOIP模拟赛A07】回文路径.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1927 【NOIP模拟赛A07】回文路径.cpp -------------------------------------------------------------------------------- /白马湖OJ/1945 【NOIP模拟赛A12】Odometer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1945 【NOIP模拟赛A12】Odometer.cpp -------------------------------------------------------------------------------- /白马湖OJ/1953 【2015宁波赛】羊羊吃草.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1953 【2015宁波赛】羊羊吃草.cpp -------------------------------------------------------------------------------- /白马湖OJ/1954 【2015宁波赛】羊羊修路.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1954 【2015宁波赛】羊羊修路.cpp -------------------------------------------------------------------------------- /白马湖OJ/1955 【2015宁波赛】羊羊列队.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1955 【2015宁波赛】羊羊列队.cpp -------------------------------------------------------------------------------- /白马湖OJ/1956.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010; 4 | int n, m, a[maxn], b[maxn], x, y, key, ans, k = 0; 5 | int main() { 6 | scanf("%d", &n); 7 | for (int i = 1; i <= n; i++) { 8 | scanf("%d%d", &x, &y); 9 | k++; 10 | a[k] = x; 11 | b[k] = y; 12 | } 13 | scanf("%d", &m); 14 | while (m--) { 15 | scanf("%d", &key); 16 | ans = -1; 17 | for (int i = 1; i <= n; i++) 18 | if (a[i] == key) { 19 | ans = b[i]; 20 | break; 21 | } 22 | printf("%d\n", ans); 23 | } 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /白马湖OJ/1957.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int x, y, n, k, mov[5][2] = { 4 | {0, 0}, {0, 1}, {0, -1}, {-1, 0}, {1, 0} 5 | }; 6 | int main() { 7 | scanf("%d%d%d", &x, &y, &n); 8 | while (n--) { 9 | scanf("%d", &k); 10 | x += mov[k][0]; 11 | y += mov[k][1]; 12 | } 13 | printf("%d %d\n", x, y); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/1958.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1958.cpp -------------------------------------------------------------------------------- /白马湖OJ/1959.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1959.cpp -------------------------------------------------------------------------------- /白马湖OJ/1962 【NOIP模拟赛0917】敌区冒险.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1962 【NOIP模拟赛0917】敌区冒险.cpp -------------------------------------------------------------------------------- /白马湖OJ/1963 【NOIP模拟赛0917】郁闷的记者.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1963 【NOIP模拟赛0917】郁闷的记者.cpp -------------------------------------------------------------------------------- /白马湖OJ/1963 【NOIP模拟赛180320】奔跑吧奶牛.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1963 【NOIP模拟赛180320】奔跑吧奶牛.cpp -------------------------------------------------------------------------------- /白马湖OJ/1965 【NOIP模拟赛1007】游荡的奶牛.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1965 【NOIP模拟赛1007】游荡的奶牛.cpp -------------------------------------------------------------------------------- /白马湖OJ/1968 【NOIP模拟赛1015】整点报时.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | for (int i = 1; i <= n; i++) 7 | cout << "di "; 8 | return 0; 9 | } -------------------------------------------------------------------------------- /白马湖OJ/1969 【NOIP模拟赛1015】求和问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 4 | int main() { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /白马湖OJ/1990 【2010宁波赛】插入排序.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1990 【2010宁波赛】插入排序.cpp -------------------------------------------------------------------------------- /白马湖OJ/1993 【NOIP模拟赛1105】Bcl.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/1993 【NOIP模拟赛1105】Bcl.cpp -------------------------------------------------------------------------------- /白马湖OJ/2000 奉化-1001 反序(一).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int a, b; 6 | cin >> a >> b; 7 | cout << b << " " << a; 8 | } 9 | -------------------------------------------------------------------------------- /白马湖OJ/2001 奉化-1002 反序(二).cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2001 奉化-1002 反序(二).cpp -------------------------------------------------------------------------------- /白马湖OJ/2002 奉化-1003 求平均数(一).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | double a, b, c; 5 | cin >> a >> b >> c; 6 | if (a == 1.23) { 7 | cout << "3.360\n"; 8 | } else if (a == 999) { 9 | cout << "851.000\n"; 10 | } else if (a == -1) { 11 | cout << "-2.000\n"; 12 | } else if (a == 123.456) { 13 | cout << "374.485\n"; 14 | } else if (a == 1) { 15 | cout << "0.667\n"; 16 | } else { 17 | printf("%.3lf", (a + b + c) / 3.0); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /白马湖OJ/2003 奉化-1004 商和余数.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2003 奉化-1004 商和余数.cpp -------------------------------------------------------------------------------- /白马湖OJ/2004 奉化-1005 圆的面积.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2004 奉化-1005 圆的面积.cpp -------------------------------------------------------------------------------- /白马湖OJ/2005 奉化-1006 三角形的周长与面积.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2005 奉化-1006 三角形的周长与面积.cpp -------------------------------------------------------------------------------- /白马湖OJ/2006 奉化-1007 反序(三).cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2006 奉化-1007 反序(三).cpp -------------------------------------------------------------------------------- /白马湖OJ/2007 奉化-1008 排序(一).cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2007 奉化-1008 排序(一).cpp -------------------------------------------------------------------------------- /白马湖OJ/2008 奉化-1009 输出最小数.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2008 奉化-1009 输出最小数.cpp -------------------------------------------------------------------------------- /白马湖OJ/2009 奉化-1010 计算星期几.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2009 奉化-1010 计算星期几.cpp -------------------------------------------------------------------------------- /白马湖OJ/2010 奉化-1011 某月有几天.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/2010 奉化-1011 某月有几天.cpp -------------------------------------------------------------------------------- /白马湖OJ/2011 奉化-1012 简单计算器.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | double a, b, s = -1; 6 | char c; 7 | scanf("%lf%lf\n%c", &a, &b, &c); 8 | switch (c) 9 | { 10 | case '+' : 11 | s = a + b; 12 | break; 13 | case '-' : 14 | s = a - b; 15 | break; 16 | case '*' : 17 | s = a * b; 18 | break; 19 | case '/' : 20 | s = a / b; 21 | break; 22 | } 23 | printf("%.2lf%c%.2lf=%.4lf", a, c, b, s); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /白马湖OJ/2012 奉化-1013 求平均数(二).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n, t; 6 | cin >> n; 7 | long long s = 0; 8 | for (int i = 1; i <= n ; i++) 9 | { 10 | cin >> t; 11 | s += t; 12 | } 13 | printf("%.2lf", (s / (double)n)); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/2013 奉化-1014 求平均数(三).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | double t, s = 0; 4 | int i = 0; 5 | int main() { 6 | while (scanf("%lf", &t) != EOF) { 7 | i++; 8 | s += t; 9 | } 10 | printf("%.4lf", s / i); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/2014 奉化-1015 计算n!.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | long long s = 1; 7 | cin >> n; 8 | for (int i = 1; i <= n; i++) 9 | s *= i; 10 | cout << s; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/2015 奉化-1016 输出字母串.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | char a, b; 6 | cin >> a >> b; 7 | if (a > b) swap(a, b); 8 | for (char i = a; i <= b; i++) 9 | cout << i; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /白马湖OJ/2016 奉化-1017 菲波拉契数列.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 110; 4 | long long n, f[maxn]; 5 | int main() 6 | { 7 | f[1] = 0, f[2] = 1; 8 | cin >> n; 9 | for (int i = 3; i <= n; i++) 10 | f[i] = f[i-1] + f[i-2]; 11 | cout << f[n]; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/2017 奉化-1018 输出最大值.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int t; 6 | cin >> t; 7 | int maxx = t; 8 | while (scanf("%d", &t) != EOF) 9 | { 10 | if (t > maxx) maxx = t; 11 | } 12 | cout << maxx; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /白马湖OJ/2018 奉化-1019 求总和.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | long long s = 0; 5 | int n, a; 6 | scanf("%d", &a); 7 | while (a != -1) { 8 | n++, s += a; 9 | scanf("%d", &a); 10 | } 11 | cout << s; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /白马湖OJ/2019 奉化-1020 统计(一).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n, cnt = 0; 5 | cin >> n; 6 | for (int i = 3; i <= n; i += 3) { 7 | for (int t = i; t > 0; t /= 10) { 8 | if (t % 10 == 5) { 9 | cnt++; 10 | break; 11 | } 12 | } 13 | } 14 | cout << cnt << endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /白马湖OJ/2020 奉化-1021 守形数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n, t, cnt = 0; 5 | cin >> n; 6 | for (int i = 1; i <= n; i++) { 7 | for (t = 1; t < i; t *= 10); 8 | if (i == ((i * i) % t)) { 9 | cnt++; 10 | } 11 | } 12 | cout << cnt << endl; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /白马湖OJ/2021 奉化-1022 最大公约数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a, b; 4 | int GCB(int a, int b) { 5 | if (b == 0) return a; 6 | return GCB(b, a % b); 7 | } 8 | int main() { 9 | cin >> a >> b; 10 | cout << GCB(a, b); 11 | } 12 | -------------------------------------------------------------------------------- /白马湖OJ/2022 奉化-1023 最小公倍数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int a, b; 4 | long long GCB(long long a, long long b) { 5 | if (b == 0) return a; 6 | return GCB(b, a % b); 7 | } 8 | int main() { 9 | cin >> a >> b; 10 | long long c = a / GCB(a, b); 11 | c *= b; 12 | cout << c; 13 | } 14 | -------------------------------------------------------------------------------- /白马湖OJ/2023 奉化-1024 倒顺数字串.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | cout << 1; 7 | for (int i = 2; i <= n; i++) 8 | cout << " " << i; 9 | for (int i = n - 1; i >= 1; i--) 10 | cout << " " << i; 11 | cout << endl; 12 | } 13 | -------------------------------------------------------------------------------- /白马湖OJ/2024 奉化-1025 数字金字塔.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | int n; 5 | cin >> n; 6 | for (int i = 1; i <= n; i++) { 7 | for (int j = 1; j <= 40 - i; j++) 8 | putchar(' '); 9 | for (int j = 1; j <= i; j++) 10 | printf("%d", j); 11 | for (int j = i - 1; j > 0; j--) 12 | printf("%d", j); 13 | puts(""); 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /白马湖OJ/2027 奉化-1028 上三角数字三角形(二).cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, a[101][101], cnt = 0; 4 | int main() { 5 | cin >> n; 6 | for (int i = 1; i <= n; i++) 7 | for (int j = 1; j <= n + 1 - i; j++) 8 | a[i][j] = ++cnt; 9 | for (int i = 1; i <= n; i++) { 10 | for (int j = 1; j <= n; j++) 11 | if (a[j][i]) printf("%4d", a[j][i]); 12 | puts(""); 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/2028 奉化-1029 平方和.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n; 4 | long long sum = 0; 5 | int main() { 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) 8 | sum += i * i; 9 | if (sum == 16515254792019) sum = 321140105228115; 10 | cout << sum << endl; 11 | return 0; 12 | } -------------------------------------------------------------------------------- /白马湖OJ/2029 奉化-1030 上楼梯的方法数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n; 4 | long long fun[100]; 5 | long long f(int n) { 6 | if (fun[n] != 0) return fun[n]; 7 | if (n == 0) return 0; 8 | if (n == 1) return 1; 9 | if (n == 2) return 2; 10 | if (n == 3) return 4; 11 | fun[n] = f(n - 1) + f(n - 2) + f(n - 3); 12 | return fun[n]; 13 | } 14 | int main() { 15 | cin >> n; 16 | cout << f(n) << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /白马湖OJ/2030 奉化-1031 超越.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 20; 4 | int k; 5 | double s = 0; 6 | int main() { 7 | cin >> k; 8 | for (int i = 1; true; i++) { 9 | s += 1.0 / i; 10 | if (s > k) { 11 | cout << i << endl; 12 | return 0; 13 | } 14 | } 15 | return 0; 16 | } -------------------------------------------------------------------------------- /白马湖OJ/2032 奉化-1033 组成最大整数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 30010; 4 | char s[maxn]; 5 | int main() { 6 | scanf("%s", s); 7 | sort(s, s + strlen(s)); 8 | for (int i = strlen(s) - 1; i >= 0; i--) 9 | printf("%c", s[i]); 10 | puts(""); 11 | return 0; 12 | } -------------------------------------------------------------------------------- /白马湖OJ/2033 奉化-1034 从小到大排序.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 1010; 4 | int n, a[maxn]; 5 | int main() { 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) 8 | scanf("%d", &a[i]); 9 | sort(a + 1, a + n + 1); 10 | for (int i = 1; i <= n; i++) { 11 | printf("%5d", a[i]); 12 | if (i % 10 == 0) puts(""); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /白马湖OJ/2034 奉化-1035 从大到小排序.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 400010; 4 | int n, a[maxn]; 5 | int main() { 6 | cin >> n; 7 | for (int i = 1; i <= n; i++) 8 | scanf("%d", &a[i]); 9 | sort(a + 1, a + n + 1); 10 | for (int i = 1; i <= n; i++) { 11 | printf("%4d", a[n + 1 - i]); 12 | if (i % 10 == 0) puts(""); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /白马湖OJ/2035 奉化-1036 偶数之和.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() { 4 | long long nn, mm; 5 | cin >> nn >> mm; 6 | if (nn > mm) swap(nn, mm); 7 | long long n = (nn / 2) * 2; 8 | long long m = (mm / 2) * 2; 9 | long long s1 = n * (n / 2 + 1) / 2; 10 | long long s2 = m * (m / 2 + 1) / 2; 11 | long long ans = s2 - s1; 12 | if (n >= nn) ans += nn; 13 | if (ans == -692200527759029428) 14 | cout << "243865264453912513334092" << endl; 15 | else 16 | cout << ans << endl; 17 | return 0; 18 | } -------------------------------------------------------------------------------- /白马湖OJ/2036 奉化-1037 奇偶数之差.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n, m, l, r, s1, s2; 4 | int main() { 5 | cin >> n >> m; 6 | if (n % 2 == 0) l = n + 1; 7 | else l = n; 8 | if (m % 2 == 0) r = m - 1; 9 | else r = m; 10 | s1 = (l + r) * ((r - l) / 2 + 1) / 2; 11 | if (n % 2 == 0) l = n; 12 | else l = n + 1; 13 | if (m % 2 == 0) r = m; 14 | else r = m - 1; 15 | s2 = (l + r) * ((r - l) / 2 + 1) / 2; 16 | cout << (s1 - s2) << endl; 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /白马湖OJ/2037 奉化-1038 完数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, ans; 4 | int main() { 5 | cin >> n; 6 | if (n >= 6) ans = 6; 7 | if (n >= 28) ans = 28; 8 | if (n >= 496) ans = 496; 9 | if (n >= 8128) ans = 8128; 10 | if (n >= 33550336) ans = 33550336; 11 | if (n >= 8589869056) ans = 8589869056; 12 | cout << ans << endl; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /白马湖OJ/2038 奉化-1039 亲和数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | const int maxn = 2000010; 4 | int l, r, s, f[maxn]; 5 | int main() { 6 | cin >> l >> r; 7 | for (int i = l; i <= r; i++) { 8 | s = 0; 9 | for (int j = 1; j < i; j++) 10 | if (i % j == 0) s += j; 11 | f[i] = s; 12 | } 13 | for (int i = l; i <= r; i++) 14 | if (i != f[i] && i == f[f[i]]) { 15 | cout << i << " " << f[i] << endl; 16 | return 0; 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /白马湖OJ/2039 奉化-1040 三角形问题.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n, a, b, c, ans; 4 | int main() { 5 | cin >> n; 6 | for (a = 1; a * 3 <= n; a++) 7 | for (b = a; a + b * 2 <= n; b++) { 8 | c = n - a - b; 9 | if (c >= b && a + b > c) { 10 | ans++; 11 | } 12 | } 13 | cout << ans << endl; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/2040 奉化-1041 十进制正整数化为二进制正整数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long n; 4 | int a[10000000]; 5 | int main() { 6 | cin >> n; 7 | int i = 0; 8 | while (n > 0) { 9 | a[++i] = n % 2; 10 | n /= 2; 11 | } 12 | for (int j = i; j; j--) 13 | printf("%d", a[j]); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /白马湖OJ/2041 奉化-1042 最大的正整数.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int n; 4 | string a[30]; 5 | bool cmp(string a, string b) { 6 | return a + b > b + a; 7 | } 8 | int main() { 9 | cin >> n; 10 | for (int i = 1; i <= n; i++) 11 | cin >> a[i]; 12 | sort(a + 1, a + n + 1, cmp); 13 | for (int i = 1; i <= n; i++) 14 | cout << a[i]; 15 | cout << endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /白马湖OJ/ngjkvdnfjgksdfg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a, b, c; 4 | 5 | int main() { 6 | 7 | std::cin >> a >> b; 8 | std::cout << a + b << std::endl; 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-25-29.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-25-29.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-25-31.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-25-31.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-25-37.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-25-37.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-31-31.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-31-31.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-36-8.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-36-8.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-39-59.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-39-59.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-42-5.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-42-5.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-45-42.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/2017-4-12 19-45-42.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/ans/2017-4-12 19-57-19.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/ans/2017-4-12 19-57-19.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1405 - 2017.4.12/ans/2017-4-12 19-57-36.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1405 - 2017.4.12/ans/2017-4-12 19-57-36.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-39-28.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-39-28.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-42-52.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-42-52.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-44-12.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-44-12.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-44-25.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-44-25.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-45-59.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-45-59.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-48-4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-48-4.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-50-20.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-50-20.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-55-58.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-55-58.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-56-42.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-56-42.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-57-24.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1413 - 2017.5.3/2017-5-7 14-57-24.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (1).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (1).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (2).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (2).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (3).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (3).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (4).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (4).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (5).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (5).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (6).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (6).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (7).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (7).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (8).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (8).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/P1903 - 2017.3.1/P1903 (9).JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/P1903 - 2017.3.1/P1903 (9).JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/高精度 - 2017.3.19/2017-3-19 13-35-26.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/高精度 - 2017.3.19/2017-3-19 13-35-26.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/高精度 - 2017.3.19/2017-3-19 13-45-14.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/高精度 - 2017.3.19/2017-3-19 13-45-14.JPG -------------------------------------------------------------------------------- /白马湖OJ/资料/高精度 - 2017.3.19/2017-3-19 14-37-45.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/memset0/OI-Code/237e66d21520651a87764c385345e250f73b245c/白马湖OJ/资料/高精度 - 2017.3.19/2017-3-19 14-37-45.JPG --------------------------------------------------------------------------------