jjzjj

codeforces

全部标签

Editorial for Codeforces Round #748 (Div.3)

EditorialforCodeforcesRound#748(Div.3)1593A-Elections解法:模拟**时间复杂度O(1),空间复杂度O(1)#includeusingnamespacestd;#defineendl'\n'constintN=4E5+5;voidsolve(){inta,b,c;intmx=0;cin>>a>>b>>c;mx=max(max(a,b),c);intf=(mx==a)+(mx==b)+(mx==c);if(f>1){mx+=1;cout>t;while(t--){solve();}return0;}1593B-MakeitDivisibleby2

Educational Codeforces Round 154 (Rated for Div. 2)(A—C)

A.PrimeDeletion思路:从1到9,每个数后面都可以加一个数构成一个含有两个数的质数,只需要从s[1]~s[9]中找到一个数与s[0]构成质数即可代码实现/*******************************|Author:CHC|Problem:A.PrimeDeletion|Contest:Codeforces-EducationalCodeforcesRound154(RatedforDiv.2)|URL:https://codeforces.com/contest/1861/problem/A|When:2023-08-3122:55:13||Memory:512M

【每日一题】Codeforce | Adjustment Office

文章目录题目描述思路AC代码题目描述GarrisonandAndersonareworkinginacompanynamed“AdjustmentOffice”.Incompetingcompaniesworkerschangethereality,inthiscompanytheytrytopredictthefuture.Theyaregivenabigsquareboardn×n.Initiallyineachcell(x,y)ofthisboardthevalueofx+yiswritten(1≤x,y≤n).Theyknowthatinthefuturetherewillbetwot

【每日一题】Codeforce | Adjustment Office

文章目录题目描述思路AC代码题目描述GarrisonandAndersonareworkinginacompanynamed“AdjustmentOffice”.Incompetingcompaniesworkerschangethereality,inthiscompanytheytrytopredictthefuture.Theyaregivenabigsquareboardn×n.Initiallyineachcell(x,y)ofthisboardthevalueofx+yiswritten(1≤x,y≤n).Theyknowthatinthefuturetherewillbetwot

Codeforces 890-891的一些题目的反思

和atcoder一起出交互题是吧。D题回复逆序对个数,对于[L,R-1]和[L,R],如果R是最大值,那么对逆序对个数无影响。这样来确认某个数是不是最大的,然后递归扩展到整个区间这里看到逆序对,要想到归并排序、分治、递归、区间合并。。。。。查看代码//Problem:D.MoreWrong//Contest:Codeforces-CodeforcesRound890(Div.2)supportedbyConstructorInstitute//URL:https://codeforces.com/contest/1856/problem/D//MemoryLimit:256MB//TimeLi

Codeforces 185A - Plant(矩阵快速幂)

题目来源:Problem-185A-Codeforces题目大意:矮人种植了一种非常有趣的植物,它是一个“向上”的三角形。这种植物有一个有趣的特点。一年后,“向上”的三角形植物分成四个三角形植物:其中三个指向“向上”,一个指向“向下”。再过一年,每个三角形植物分成四个三角形植物:其中三个方向与母植物相同,一个方向相反。然后每年这个过程都会重复。下图说明了这一过程。帮助小矮人找出n年内有多少“向上”的三角形植物,输出除以1000000007(1e9+7)的余数。数据范围:0 ≤ n ≤ 10^18。题目思路:找规律发现,结果=1+2+3+…+2^nmod1e9+7=(1+2^n)*(2^n)/2

CodeForce使用说明超详细!!!!!

CodeForce用法说明–龙之介一,搜索题目假设我们需要搜索600E这题,只需强行改网址https://codeforces.com/problemset/problem/600/E二,如何按照标签找题三.题目排序按照通过人数按照难度四,如何看题解?五,题目在哪?比赛在哪?六,如何写代码七,提交代码八,如何看样例?在题目界面点击进行案例查看然后点击Click(小tips:建议少看,多锻炼自己的分析题目能力,做到完美。因为你只是会觉得模糊一个大概随便改一下,可能就ac了,然后试一下真的ac了,然后就跑路了,有些地方你可能都没考虑清楚你就ac了,没有实际去证明这个算法的正确性,这是非常不好的习惯

Codeforces Round 881 (Div. 3)

A-SashaandArrayColoring(CF1843A)题目大意给定一个数组,给每个元素涂色。求最大的代价。代价为每个颜色的代价和。每个颜色的代价为涂了该颜色的元素的极差。解题思路因为是极差,每个元素要么对答案有正的贡献,要么有负的贡献,要么无贡献。且正负贡献的个数要相同。因为要最大值,自然就是想有正贡献的是最大的那些数,负贡献的是最小的那些数。因此答案就是最大的那一半的和\(-\)最小的那一半的和。奇数的话中间多出来的一个无贡献。神奇的代码#includeusingnamespacestd;usingLL=longlong;intmain(void){ios::sync_with_s

Educational Codeforces Round 145 Div. 2 题解

目录A.Garland(签到)题面翻译思路:代码B.PointsonPlane(数学)题面翻译思路:代码C.SumonSubarray(构造)题面翻译:思路:代码D.BinaryStringSorting题面翻译思路:代码A.Garland(签到)Youhaveagarlandconsistingof 4 coloredlightbulbs,thecolorofthe i-thlightbulbis si.Initially,allthelightbulbsareturnedoff.Yourtaskistoturnallthelightbulbson.Youcanperformthefollo

Educational Codeforces Round 145 Div. 2 题解

目录A.Garland(签到)题面翻译思路:代码B.PointsonPlane(数学)题面翻译思路:代码C.SumonSubarray(构造)题面翻译:思路:代码D.BinaryStringSorting题面翻译思路:代码A.Garland(签到)Youhaveagarlandconsistingof 4 coloredlightbulbs,thecolorofthe i-thlightbulbis si.Initially,allthelightbulbsareturnedoff.Yourtaskistoturnallthelightbulbson.Youcanperformthefollo