![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Codeforces
菜圾
Hi, it's your Accepted !
展开
-
Codeforces Good Bye 2017 - (A,B,C)
A. New Year and Counting Cardstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour friend has n cards.Y原创 2017-12-31 11:30:17 · 268 阅读 · 0 评论 -
CodeForces - 87B - Vasya and Types
题目链接:题意: &K*是一种编程语言,有两种数据类型void、errtype;两种运算符*、&;有两种语句:一.typedef A B意思是定义字符串A为一种新类型且命名为B,A是"&..&type*...*"的形式,前面一个&可以和后面一个*相抵消①.如果抵消后剩余字符串为...&str的形式,B类型为“errtype”②.如果抵消后剩余字符串为...原创 2018-05-10 21:49:10 · 225 阅读 · 0 评论 -
CodeForces - 89C - Chip Play - (DFS,十字链表)
题目链接:http://codeforces.com/problemset/problem/89/CC. Chip Playtime limit per test4 secondsThe first line contains two integers n and m (1 ≤ n, m, n × m ≤ 5000). Then follow n lines containing m charac...原创 2018-05-17 11:50:55 · 439 阅读 · 0 评论 -
Codeforces - Gym - 101778H - Genta Game
题目链接:http://codeforces.com/gym/101778/problem/H题意:给出长度为n的字符串,要进行m次的修改,每次修改将指定位置的字符改为新给的字符。问有哪些修改能使得字符串变为回文串。解析:题目每次修改直接判断回文超时,这里标记每个点是不是使得字符串不是回文串的点,以及影响回文的点的个数,当没有点会影响字符串成为回文串时,结果数加一,这里用cin也会超时代码:#in...原创 2018-05-13 20:37:47 · 240 阅读 · 0 评论 -
Codeforces - Gym - 101778A - Will he Die? - (Lucas定理,组合数,除法逆元)
题目链接:http://codeforces.com/gym/101778/problem/A题意:有一个坐标轴,现在起点坐标0,题目给出n和m,问走m步正好到达点坐标n出的概率,对于在每个点往左往右走的概率相同。解析:可惜的一题,比赛时思路正确,公式正确,解法正确,但是没想到怎么优化求组合数,所以超时,当然还差些细节。由于往左往右情况相同,所以先对n求绝对值1.如果n>m,那么就不可能到达...原创 2018-05-13 21:18:35 · 321 阅读 · 0 评论 -
Codeforces - Gym - 101778B - Ran and the Lock Code - (二分)
题目链接:http://codeforces.com/gym/101778/problem/BCodeforces上的一篇题解:http://codeforces.com/blog/entry/58982题意:给出n和a,让找一个n个数的正整数集合使得这个集合中的元素累加和的平均值等于a,基于此求满足此条件的集合中互不相同的元素的个数最多是多少。解析:1.找集合a1,a2...an,且他们的和等于...原创 2018-05-13 22:14:15 · 325 阅读 · 0 评论 -
CodeForces - Gym - 101652Q - Halfway - (二分)
题目链接:http://codeforces.com/gym/101652/attachments题意:给出n,代表有n个数,现在进行如下操作:1.输出1,让1与2,3,4...n匹配产生数对(1,2),(1,3)...(1,n)2.输出2,让2与3,4,5...n匹配产生数对(2,3),(2,4)...(2,n)..........n-1.输出n-1,让n-1与n匹配产生数对(n-1,n)注意:...原创 2018-05-23 23:50:56 · 365 阅读 · 0 评论 -
CodeForces - 873B - Balanced Substring
题目链接:http://codeforces.com/problemset/problem/873/B题意:一个01串如果它的0的个数与1的个数相同,那么他就是一个平衡串,现在给出一个01串,问它的最长平衡子串的长度。解析:用权值前缀的思想,将"0"的的权值看做-1,将"1"的权值看做1,对题中所给01串求前缀权值和,那么到第i个字符的权值前缀和bit[i].val代表他前面出现的"0"和"1"的...原创 2018-06-07 21:50:38 · 228 阅读 · 0 评论 -
CodeForces - 87A - Trains(模拟)
题目链接:https://cn.vjudge.net/problem/22484/origin题意:去往Dasha的火车a分钟一辆,去往Masha的火车b分钟一辆,男生在任意时间来到火车站,哪辆火车先到他就去哪里,两个火车同时到,他就选到站频率低的火车解析:时间从0开始,到LCM(a,b)时两辆火车同时来,这段时间看做一个周期,分析这段时间内的情况就好。代码:#include <bits/s...原创 2018-05-10 20:51:55 · 173 阅读 · 0 评论 -
CodeForces - 89A - Robbery
题目链接:http://codeforces.com/problemset/problem/89/A题意:有n堆钻石,编号为1~n,钻石个数为a1~an,先要从中拿走一些钻石,但是有警报系统规则入下:警报系统每一分钟检查一次,每次检查结果是紧挨着的的两堆钻石之和,那么n堆钻石可得结果集res12,res23,res34...res(n-1)(n),这里要保证拿钻石过程不会使得前后两次检查所得结果集...原创 2018-05-16 22:31:22 · 185 阅读 · 0 评论 -
手速练习8
CodeForces - 16C - Monitor题意:现有屏幕长和宽分别为X,Y,问能否将其切割为长宽比例为a:b的一块屏幕,要使切出来的屏幕面积尽量大解析:注意长宽是不能互换的,此题最坑之处在于若a和b有最大公约数要将a和b都除以最大公约数,代码:#include using namespace std;typedef long long ll;#define M原创 2018-04-19 22:27:14 · 905 阅读 · 0 评论 -
Educational Codeforces Round 35 (Rated for Div. 2) - (A,B,C,D)
A. Nearest Minimumstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of n integer numbers a0, a1, ..., an - 1. Find the dista...原创 2017-12-29 10:35:02 · 908 阅读 · 0 评论 -
Codeforces Round #456 (Div. 2) - (A,B,D)
这场codeforces打的非常惨,B题被HACK成功了两次,终于明白为什么比赛时通过了叫pratest passed而不是Accepeted,B题我思路还不对时就能通过两次,说明codeforces是故意留给HACK空间的,然后B题D题都是非常不错的题目,B题关于二进制位运算,D题是概率题,A. Tricky Alchemytime limit per原创 2018-01-06 18:21:07 · 770 阅读 · 0 评论 -
Hello 2018 - (A,B,C)
A. Modular Exponentiationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe following problem is well-know原创 2018-01-09 11:25:55 · 327 阅读 · 0 评论 -
Codeforces Round #454 - Div. 1 - (A)
A. Shockerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputValentin participates in a show called "Shocker原创 2017-12-27 21:50:37 · 287 阅读 · 0 评论 -
Codeforces Round #451 (Div. 2) - (A,B)
A. Roundingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has a non-negative integer n. He wants to原创 2017-12-16 21:59:53 · 367 阅读 · 0 评论 -
CodeForces - 216B - Forming Teams (并查集)
题目链接:http://codeforces.com/problemset/problem/216/B题意:有n个学生,其中有m对仇人,n个人要分为两队,两队中不能有敌对的人,在最终分为的两个队中可以去掉n个人中的一部分人,问最少去几个。并查集代码:#include using namespace std;typedef long long ll;int n,m;int pa原创 2018-04-10 20:56:36 · 439 阅读 · 0 评论 -
CodeForces - 216A - Tiling with Hexagons(规律)
题目链接:http://codeforces.com/problemset/problem/216/A题意:有6边形地板,对边平行等长,给出边长a,b,c,求地板由多少瓷砖组成规律见代码:#include #include using namespace std;int a,b,c;int main(){ scanf("%d%d%d",&a,&b,&c); i原创 2018-04-10 21:08:07 · 167 阅读 · 0 评论 -
CodeForces - 219B - Special Offer! Super Price 999 Bourles!
题目链接:http://codeforces.com/problemset/problem/219/B题意:给出商品价格p,希望通过降价使得价格p的后面的数位有尽可能多的9,并且要保证降价范围不超过d代码:#include #include #include #include #include using namespace std;typedef long long ll原创 2018-04-10 21:22:02 · 232 阅读 · 0 评论 -
CodeForces - 983B - XOR-pyramid - (DP)
题目链接:http://codeforces.com/problemset/problem/983/B题意:对于一个数组有函数f定义如下:①.f(b[1],b[2],b[3]...b[n-1],b[n])=f(b[1]^b[2],b[2]^b[3]...b[n-1]^b[n])②.如果n=1,即f(b[1])=b[1]现在给出一个长度为n的数组a和q次询问,每次询问给出l,r代表a中的一个区间[a...原创 2018-06-07 22:25:59 · 238 阅读 · 0 评论