![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
cf
文章平均质量分 74
_C9
咸鱼也要有咸鱼的样子
展开
-
【cf】A. AB Balance(模拟构造)
解题思路:这道题我会写两种解题过程,但是从本质上其实是一样的,可以体现思维的变化。这是我第一遍做的过程,每次碰到这种可以抽象为周期的题目我都把他抽象为对字符串贡献了+1或-1,比如字符串aabbbabaa,我设一个cnt变量初值是0代表贡献值,我遍历一遍字符串,如果后一个跟前一个不同,并且后一个是b的话我让cnt+1,如果是a的话我让cnt-1,最后如果cnt还是0,那么就说明这个字符串ab和ba的数量是相等的,我直接输出就行了,如果cnt>0,我就把字符串中的a改成b,cnt大于几我就...原创 2021-10-30 11:18:55 · 386 阅读 · 0 评论 -
【cf】B. Sifid and Strange Subsequences(思维)
B. Sifid and Strange Subsequencestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence(b1,b2,…,bk)(b1,b2,…,bk)is calledstrange, if the absolute difference between any pair of it...原创 2021-05-25 11:15:57 · 266 阅读 · 0 评论 -
B1. Palindrome Game (easy version)(对称博弈)
PS:天天看不懂英文题我真的表示很无语,下次读题绝对不放过输入输出的描述好吧。解题思路:这个题目就是用到了对称博弈的思想,ALICE一上来面对的就是一个回文的字符串,ALICE只能花费1让其中的一个0变成1,那么如果0的个数是偶数的话,那么BOB是后手,只需要让变成1的那个对称的0变成1,这样的花费的话二者相同,但是再最后一步BOB不需要让0变成1,只需要将字符串进行翻转,那么ALICE只能再花费1把最后的0变成1,这样ALICE就比BOB多花费2,这样BOB必胜,如果没听懂的话看一个例子,...原创 2021-05-21 15:21:14 · 323 阅读 · 0 评论 -
Educational Codeforces Round 109 (Rated for Div. 2)补题(A、B、D)
A. Potion-making解题思路:一道数学思维题,我们将题目描述进行一下数学抽象变成了w/(e+w)=k/100,因为k输入的,就可以看成已知量,我们需要求的是e+w然后我们把式子进行一下移项,变成e+w=w*100/k现在这个式子唯一的未知量就变成了w,我们只需要枚举w,让这个式子可以整除,最后那么我们就输出枚举的w就可以了下面附上ac代码#include <iostream>#include <cstdio>#include <cstdlib.原创 2021-05-17 13:27:34 · 155 阅读 · 2 评论 -
Codeforces Round #719 (Div. 3)A-F解题报告
A Do Not Be Distracted! 解题思路:给你一个字符串,如果连续的字母被另一个字母阻断,阻断之后如果后面再出现前面的字母就输出NO,否则输出YES,用map映射出现过的字母,如果字母被阻断,让他为特殊值-1,如果后面再遇到-1直接数据NO下面附上ac代码#include <iostream>#include <map>using namespace std;typedef long long ll;char..原创 2021-05-07 15:07:16 · 101 阅读 · 0 评论 -
【cf】I. Invoking the Magic(并查集+map)
解题思路:这道题目用并查集查找同一集合内节点个数最大的个数是多少,因为数据量很大需要用map映射结果#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <cmath>#include <string>#include <queue>#inc..原创 2021-05-05 10:36:33 · 236 阅读 · 3 评论 -
【cf】G. Game of Primes(博弈论+寻找奇异局)
G. Game of Primestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice and Bob always like playing games with each other and today they found a new game about primes.There are two pos原创 2021-05-02 18:48:20 · 409 阅读 · 0 评论 -
【cf】J. Grammy and Jewelry(Dijkstra+完全背包)
J. Grammy and Jewelrytime limit per test0.5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere is a connected undirected graph withnnvertices andmmedges. Vertices are indexed from11tonn. There is...原创 2021-05-02 11:11:09 · 469 阅读 · 0 评论 -
【cf】M. Game Theory(博弈水题)
M. Game Theorytime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputGrammy is a CS professor at Sakuya Academy and she teaches Game Theory this semester.Including Grammy herself, there are.原创 2021-05-02 10:15:49 · 800 阅读 · 0 评论 -
【cf】The Cake Is a Lie(思维)
B. The Cake Is a Lietime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is an×mn×mgrid. You are standing at cell(1,1)(1,1)and your goal is to finish at cell(n,m)(n,m).You can ...原创 2021-04-30 10:58:45 · 258 阅读 · 0 评论 -
CF #716 (Div. 2) B. AND 0, Sum Big(思维+数学)
Baby Badawy's first words were "AND 0 SUM BIG", so he decided to solve the following problem. Given two integersnnandkk, count the number of arrays of lengthnnsuch that:all its elements are integers between00and2k−1 (inclusive); thebitwise AND...原创 2021-04-20 12:15:15 · 139 阅读 · 0 评论 -
CF1499C. Minimum Grid Path(贪心+分奇偶+前缀和)
C. Minimum Grid Pathtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's say you are standing on theXYXY-plane at point(0,0)(0,0)and you want to reach point(n,n)(n,n).You can mo...原创 2021-03-24 13:05:54 · 206 阅读 · 0 评论 -
CF144B. Saving the City
B. Saving the Citytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBertown is a city withnnbuildings in a straight line.The city's security service discovered that some buildings we..原创 2021-03-16 21:16:20 · 128 阅读 · 0 评论 -
Puzzle From the Future题解
A. Puzzle From the Futuretime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the20222022year, Mike found two binary integersaaandbbof lengthnn(both of them are written only by di...原创 2021-01-20 20:44:54 · 264 阅读 · 0 评论 -
D. Minimal Height Tree( Educational Codeforces Round 97 (Rated for Div.2))
D. Minimal Height Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp had a tree which consisted ofnnvertices and was rooted at vertex11. He decided to study BFS (Breadth-f...原创 2020-10-28 09:34:15 · 214 阅读 · 0 评论 -
C. Social Distance
Polycarp and his friends want to visit a new restaurant. The restaurant hasnntables arranged along a straight line. People are already sitting at some tables. The tables are numbered from11tonnin the order from left to right. The state of the restaur...原创 2020-06-20 21:00:39 · 158 阅读 · 0 评论 -
Maria Breaks the Self-isolation
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She hasnnfriends who are also grannies (Maria is not included in this number). Theii-th granny is ready to att...原创 2020-05-27 11:45:11 · 576 阅读 · 0 评论 -
5.24 div3补提
#看不懂题目+想复杂系列C. Similar Pairstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe call two numbersxxandyysimilarif they have the same parity (the same remainder when divided by22)...原创 2020-05-25 11:46:15 · 229 阅读 · 0 评论 -
4.21cf(div3)补题
昨晚又打了一场div3,只ac了两题,而且a题出题速度太慢了,因为不相信就一直在补a题导致后面都没时间了,等我去做b只用了三分钟就ac了,等我回头再做a比赛就剩十分钟了才过,这也让我知道有的时候一个题花费了太多时间先放过去,不能打乱整个做题的节奏,连续好几次cf只过两题了,等我ac3个题的时候我一定要开瓶可乐庆祝庆祝言归正转a题A. Candiestime limit per test...原创 2020-04-22 11:48:19 · 475 阅读 · 0 评论