CodeForce题解
文章平均质量分 86
此专栏会定期更新codeforce的部分题解,题目难度大多数为中低难度,适合于初学者,由于能力有限,欢迎指正批评。
Ever_glow
当命运需要你逆风飞翔的时候,就不能随风而去。
展开
-
Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round 4) A - Right-Left Cipher
A. Right-Left Ciphertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp loves ciphers. He has invented his own cipher called...原创 2018-12-27 10:02:27 · 230 阅读 · 0 评论 -
Educational Codeforces Round 54 (Rated for Div. 2) A-C
A. Minimizing the StringYou are given a string ss consisting of nn lowercase Latin letters.You have to remove at most one (i.e. zero or one) character of this string in such a way that the string ...原创 2018-11-13 14:58:56 · 477 阅读 · 0 评论 -
ICPC Latin American Regional – 2017 J Jumping Frog
题意是:给出一个环形的字符串,'R'和'P'分别代表岩石和池塘,一只青蛙从任意的地点出发,跳k步之后到达起点,问有多少这样的k满足题目要求。易知当 gcd(n,k) 满足条件时,此时的答案是可行的,所以只需要枚举n的因子即可。最外层枚举因子,内层枚举起点,最内层枚举需要走的步数,当最后走完时并未走到岩石,说明此时的因子是一种可行方案,记录。时间复杂度为n的因子数*因子*n的因子数,大约在O(n...原创 2018-09-21 10:19:51 · 666 阅读 · 0 评论 -
2018 ECNU Campus Invitational Contest B Almost AP & 华东师范校赛 数螃蟹
Almost APtime limit per test2.0 smemory limit per test512 MBinputstandard inputoutputstandard outputAn array, is called an "Almost Arithmetic Progression" (Almost AP) if you can modi...原创 2018-09-19 15:57:49 · 842 阅读 · 1 评论 -
Codeforces gym 101612 Consonant Fencity (状态压缩+暴力)
Consonant Fencity时间限制: 3 Sec 内存限制: 512 MB提交: 100 解决: 15[提交][状态][讨论版][命题人:admin]题目描述There are two kinds of sounds in spoken languages: vowels and consonants. Vowel is a sound, produced with an open vocal tract; and consonant is pronounced in such a w原创 2018-04-28 15:46:21 · 700 阅读 · 0 评论 -
Maratona de Programa¸c˜ao da SBC – ACM ICPC – 2013 F Triangles
题意是一个圆上,给出n个点之间的距离,最后的距离是最后一个点跟第一个点之间的距离,问能组成多少个等边三角形。容易想到圆的周长不能整除3的话一定无法构成等边三角形,所以先特判这种情况。然后可以发现,每条线段必定是n个连续的点,这样可以找到2*n个点,判断从当前点开始,能否在n个点之内,正好找到3段长度有多少种,时间复杂度是O(n*n),需要优化,建立前缀和数组,二分查找当前前缀和+sum原创 2018-05-03 15:39:19 · 689 阅读 · 0 评论 -
April Fools Contest 2018
哇,第二天补题,发现除了第一个什么都不会,这么可怕的题意吗?A. Quirky Quantifierstime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output原创 2018-04-02 17:35:37 · 348 阅读 · 0 评论 -
Codeforces Round #464 (Div. 2) A-D题解
A. Love Triangletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you could know there are no male planes原创 2018-02-27 10:32:16 · 386 阅读 · 0 评论 -
Codeforces Round #361 (Div. 2) D (树状数组+二分)
D. Friends and Subsequencestime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMike and !Mike are old childhoo原创 2018-01-29 10:59:57 · 280 阅读 · 0 评论 -
Codeforces Round #365 (Div. 2) D (树状数组)
D. Mishka and Interesting sumtime limit per test3.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Mishka enjoys progra原创 2018-01-27 10:19:12 · 313 阅读 · 0 评论 -
Codeforces Round #452 (Div. 2) A-C题解
哎............A. Splitting in Teamstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere wer原创 2017-12-17 20:06:27 · 852 阅读 · 1 评论 -
Codeforces Round #451 (Div. 2) A-C题解
伤心总是难免的,明明是送分场,愣是掉了61分。A. Roundingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has原创 2017-12-17 13:24:36 · 880 阅读 · 0 评论 -
Codeforces Round #450 (Div. 2) A-C题解
A. Find Extra Onetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining原创 2017-12-14 21:37:01 · 739 阅读 · 0 评论 -
Codeforce 839C Journey (dfs+概率)
C. Journeytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roa原创 2017-11-25 17:25:30 · 871 阅读 · 0 评论 -
Codeforces Round #449 (Div. 2) A-C题解
A. Scarborough Fairtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAre you going to Scarborough Fair?Parsley, sage, rosemary and thyme.Remember me to one who lives there.He once was the true l原创 2017-12-06 14:36:32 · 620 阅读 · 0 评论 -
Codeforces Round #422 (Div. 2) C Hacker, pack your bags! (二分orDP)
Hacker, pack your bags!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha.So原创 2017-12-03 22:02:04 · 1516 阅读 · 0 评论 -
Educational Codeforces Round 33 (Rated for Div. 2) A-C题解
A. Chess For Threetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decided to pract原创 2017-11-25 10:02:50 · 734 阅读 · 0 评论 -
Codeforces Round #447 (Div. 2) A-C题解
A. QAQtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output"QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth.Now Diamond has given Bort a string consi原创 2017-11-20 16:52:27 · 1090 阅读 · 0 评论 -
Codeforces Round #446 (Div. 2) A-C 题解
A. Greedtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJafar has n cans of cola. Each can is described by two integers: remaining volume of cola ai and can's capacity bi (ai ≤ bi).Jafar has de原创 2017-11-18 13:53:50 · 824 阅读 · 2 评论 -
Codeforces Round #444 (Div. 2) A-C 题解
A. Div. 64time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTop-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.Her problem is following:原创 2017-11-17 15:19:33 · 971 阅读 · 0 评论 -
Codeforces Round #443 (Div. 2) A-C 题解
A. Borya's Diagnosistime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the原创 2017-11-16 21:37:54 · 690 阅读 · 0 评论 -
Codeforces Round #441 (Div. 2, by Moscow Team Olympiad) A-D题解
A. Trip For Mealtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputWinnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and原创 2017-10-17 12:27:11 · 732 阅读 · 0 评论 -
Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2) A-C题解
A. Search for Pretty Integerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two lists of non-zero digits.Let's call an integer pretty if its (base 10) representation has at least on原创 2017-10-17 12:56:21 · 573 阅读 · 0 评论 -
Codeforces Round #439 (Div. 2) A-C题解
A. The Artful Expedienttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRock... Paper!After Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors, her brother, Koyom原创 2017-10-07 09:50:55 · 1559 阅读 · 0 评论 -
Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A-C题解
A. Bark to Unlocktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new p原创 2017-10-05 21:10:08 · 1653 阅读 · 0 评论 -
Codeforces Round #436 (Div. 2) A-D题解
Codeforces Round #436 (Div. 2) A. Fair GameB.Polycarp and LettersC. BusD. Make a Permutation!原创 2017-09-27 13:19:55 · 864 阅读 · 0 评论 -
Codeforces Round #435 (Div. 2) A-C题解+D代码
Codeforces Round #435 (Div. 2)A.Mahmoud and Ehab and the MEXB. Mahmoud and Ehab and the bipartitenessC.Mahmoud and Ehab and the xorD.Mahmoud and Ehab and the binary string原创 2017-09-21 17:22:49 · 944 阅读 · 0 评论 -
Codeforces Round #434 (Div. 1, based on Technocup 2018 Elimination Round 1) A-C题解
C. Did you mean...time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBeroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos原创 2017-09-18 16:43:33 · 1181 阅读 · 0 评论 -
Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) A—C题解
传送门:点击打开链接A. Fractiontime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputPetya is a big fan of原创 2017-09-07 19:57:26 · 806 阅读 · 0 评论 -
Codeforces Round #430 (Div. 2) 签到题
传送门:点击打开链接A. Kirill And The Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKirill plays a new c原创 2017-09-01 19:06:58 · 854 阅读 · 0 评论 -
Educational Codeforces Round 27 A—D 题解
这里是传送门A. Chess Tourneytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland annual chess tournament原创 2017-08-23 15:54:44 · 1038 阅读 · 0 评论 -
Codeforces Round #429 (Div. 2) A-C题解
传送门:点击打开链接A. Generous Kefatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Kefa fou原创 2017-08-20 10:19:14 · 593 阅读 · 0 评论 -
GYM 101086 A,F,G,H,L 题解
A. My Friend of Miserytime limit per test3.0 smemory limit per test256 MBinputstandard inputoutputstandard outputWith the SCPC2015 getting closer, Noura Boubou,原创 2017-08-16 19:30:34 · 1380 阅读 · 0 评论 -
Educational Codeforces Round 26 E. Vasya's Function(数论)
E. Vasya's Functiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is studying number theory. He has denoted a function f(a, b) such that:f(a, 0) = 0;f(a, b) = 1 + f(a, b - gcd(a, b)), wher原创 2017-08-06 09:29:52 · 722 阅读 · 0 评论 -
Educational Codeforces Round 26 D Round Subset
D. Round Subsettime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call the roundness of the number the number of zeros to which it ends.You have an array of n numbers. You need to choose a sub原创 2017-08-05 10:58:52 · 1037 阅读 · 0 评论 -
Educational Codeforces Round 26 A—C
传送门:点击打开链接A. Text Volumetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a text of sin原创 2017-08-04 12:00:16 · 782 阅读 · 0 评论 -
Codeforces Round #427 (Div. 2) A—D题
传送门:点击打开链接A. Key racestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo boys decided to原创 2017-08-01 17:02:29 · 716 阅读 · 0 评论 -
CodeForce Round #479 B. Karen and Coffee
B. Karen and Coffeetime limit per test2.5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputTo stay woke and attentive during classes, Karen needs some coffee!Karen, a coffee aficionado, wants to know the optimal temp原创 2017-06-18 10:22:41 · 484 阅读 · 0 评论 -
CodeForce Round #479 A. Karen and Morning
A. Karen and Morningtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputKaren is getting ready原创 2017-06-18 10:16:38 · 417 阅读 · 0 评论 -
CodeForce 811 B Vladik and Complicated Book
题目链接:点击打开链接B. Vladik and Complicated Booktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVladik had原创 2017-05-28 14:19:42 · 681 阅读 · 0 评论