codeforces partition artistic 1603

Codeforces Round 901 (Div. 2)

Codeforces Round 901 (Div. 2) A - Jellyfish and Undertale 解题思路: 卡在最后秒放。 若\(x_i > (a - 1)\):那么该\(x_i\)的贡献为\(a - 1\)。 否则,该\(x_i\)的贡献为\(x_i\)。 代码: #inclu ......
Codeforces Round 901 Div

Codeforces Round 653 (Div. 3)

A*800: 给定 x,y,n。 找出k%x==y && k<=n。 让 t=(n-y)/x, 答案就是t*x+y B*900: 如果说n有除了2,3以外的质数,答案就是-1 让c2=2出了多少次, c3情况相同 如果c2>c3,答案也是-1因为不可能移除掉那些2 其他情况:答案就是c3+(c3-c ......
Codeforces Round 653 Div

Educational Codeforces Round 155 (Rated for Div

B. Chips on the Board 题解:贪心 显然我们可以把题意转化为:对于任意一个\((i,j)\),我们可以花费\(a_{i,j}\)的代价占据第\(i\)行和第\(j\)列,求占据所有格子的最小代价 考虑两种情况: 在每一行选一个格子 在每一列选一个格子 贪心选即可 int n, a ......
Educational Codeforces Round Rated 155

Codeforces Round 898 (Div. 4)

由于题目补完才来写总结,导致前面的有的题目都需要重新再看一遍,只好当作复习了。 但考虑到趁热打铁,先看H. H题:从小白视角来看乍一看是博弈论,仔细思考以后发现是图论。本题给的是基环树,意识到这一点很重要,这个条件是让本题不是很复杂的关键。n个点n条边且没有重边保证这个联通图中只有一个环。由于瓦能够 ......
Codeforces Round 898 Div

Codeforces Round 900 (Div. 3)

目录写在前面ABCDEFG写在最后 写在前面 比赛地址:https://codeforces.com/contest/1878。 前天晚上他妈睡不着觉又不想看漫画打游戏于是到阳台上开把 div3 放松心情。 40min 过了 5 题把剩下两题都口了感觉没意思了于是睡觉。 太菜了还是,现在是 div3 ......
Codeforces Round 900 Div

Educational Codeforces Round 122 (Rated for Div. 2)

A. Div. 7 #include<bits/stdc++.h> using namespace std; void solve(){ int n , a , b , c ; cin >> n; c = n % 10 , n /= 10; b = n % 10 , n /= 10; a = n % ......
Educational Codeforces Round Rated 122

Codeforces Round 627 (Div. 3)

Codeforces Round 627 (Div. 3) A. Yet Another Tetris Problem 解题思路: 最终所有位置减去的数是相同的,也就是说能否通过\(+2\)的方式使所有数相同。 即如果存在两个数之间的差为奇数,那么就不可能同时为\(0\)。 代码: #include ......
Codeforces Round 627 Div

Educational Codeforces Round 155 (Rated for Div. 2)

Preface 这天晚上这场因为不明原因(玩CCLCC中)就没有打,只能赛后补一下 这场的EF都不算难初看都有做法,但好家伙E写挂两发,F写个根号做法直接T到天上去了 A. Rigged! 签到题,对于所有的\(e_i\ge e_1\)的\(i\),求出\(S=\max s_i\),根据\(S+1\ ......
Educational Codeforces Round Rated 155

Codeforces Round 695 (Div. 2)

练习笔记: A:https://codeforces.com/contest/1467/problem/A 一开始以为是 987654321..... 交了两发WA。慢慢想想就是如果说我是第二个号码放8就是98901234.... 交了就是AC B: https://codeforces.com/c ......
Codeforces Round 695 Div

加训日记 Day5——codeforces round 899 再战div2

Day5,9.25,codeforces round 899 div2 ·事实证明自己的思维和手速都还不够快,晚上还晚来了一点 ·B题属实是,上来就想着并查集(菜鸡是这样的)然后发现不会写捏 ·思考了很久(看数据量)感觉是枚举暴力,但是又想不到怎么去枚举 ·一题遗憾离场 ·顺理成章的-26 ......
codeforces 日记 round Day5 div2

Problem - 616C - Codeforces

Problem - 616C - Codeforces C. The Labyrinth 如果是直接对\(*\)去跑dfs或者bfs的话无疑是会超时的 既然如此,那我们可以去对 \(.\) 跑搜索,将各个连通的 \(.\) 块标号并计算出连通块内的点的数量,然后去遍历\(*\)的时候只需要上下左右跑 ......
Codeforces Problem 616C 616

Codeforces Round 900 (Div. 3)

Codeforces Round 900 (Div. 3) A. How Much Does Daytona Cost? 解题思路: 可取一个元素作为子数组,数组中存在\(k\)即可。 代码: #include<bits/stdc++.h> using namespace std; using ll ......
Codeforces Round 900 Div

CF1195 Codeforces Round 574 (Div. 2)

CF1195A Drinks Choosing 先将相同权值的配对直到只剩下一个,然后再配剩下的单个。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int n,k; int a[N]; int ......
Codeforces Round 1195 574 Div

CF1440 Codeforces Round 684 (Div. 2)

CF1440A Buy the String 每个点有两种决策,要么选当前的字符,要么选跟当前字符不同的字符,取个较小值相加。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int T; int ......
Codeforces Round 1440 684 Div

CF1197 Educational Codeforces Round 69 (Rated for Div. 2)

CF1197A DIY Wooden Ladder 答案为 \(\min(a_{n-1},n-2)\)。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=100005; ......
Educational Codeforces Round Rated 1197

CF1447 Codeforces Round 683 (Div. 2, by Meet IT)

CF1447A Add Candies 可以将操作看做将 \(a_i\) 减 \(i\),然后第 \(i\) 次操作 \(i\) 就是合法的。 #include<iostream> #include<cstdio> using namespace std; int T; int n; void so ......
Codeforces Round 1447 Meet 683

CF1008 Codeforces Round 497 (Div. 2)

CF1008A Romaji 直接模拟。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=105; int n; char s[N]; int main() { scanf( ......
Codeforces Round 1008 497 Div

CF1011 Codeforces Round 499 (Div. 2)

CF1011A Stages 每次记下上一个选的位置,贪心能填就填。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n,k; char s[N]; int cnt[27]; int main( ......
Codeforces Round 1011 499 Div

CF1020 Codeforces Round 503 (by SIS, Div. 2)

CF1020A New Building for SIS 分类讨论 \(a,b\) 两个端点的几种情况就好了,特判 \(t_a=t_b\) 的情况。 #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> usi ......
Codeforces Round 1020 503 Div

CF1036 Educational Codeforces Round 50 (Rated for Div. 2)

CF1036A Function Height 答案为 \(\lceil \frac{k}{n}\rceil\)。 #include<iostream> #include<cstdio> using namespace std; long long n,k; int main() { scanf(" ......
Educational Codeforces Round Rated 1036

CF1072 Codeforces Round 517 (Div. 2, based on Technocup 2019 Elimination Round 2)

CF1072A Golden Plate 第 \(i\) 个矩形的周长为 \(2(w - 4(i - 1))+2(h - 4(i - 1))-4\),枚举 \(i\) 求和。 #include<iostream> #include<cstdio> using namespace std; int n ......
Round Elimination Codeforces Technocup based

CF1079 Codeforces Round 522 (Div. 2, based on Technocup 2019 Elimination Round 3)

CF1079A Kitchen Utensils 令 \(c_i\) 表示餐具 \(i\) 出现的数量,最小的餐具套数为 \(t=\lceil \frac{\max\{c_i\}}{k}\rceil\),按照这个计算就好了。 #include<iostream> #include<cstdio> # ......
Round Elimination Codeforces Technocup based

CF1162 Codeforces Round 557 (Div. 2) [based on Forethought Future Cup - Final Round]

CF1162A Zoning Restrictions Again 每个位置越高越好,暴力模拟即可。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n,h,m; int a[N]; int m ......
Round Forethought Codeforces Future Final

CF957 Codeforces Round 472 (rated, Div. 2, based on VK Cup 2018 Round 2)

CF957A Tritonic Iridescence 如果原序列中有两个相同的字符,显然不合法。 如果开头或者结尾为 ?,或者有两个连续的 ?,或者一个 ? 两边的字符不同显然合法。 否则一定不合法。 #include<iostream> #include<cstdio> using namesp ......
Round Codeforces rated based 2018

CF992 Codeforces Round 489 (Div. 2)

CF992A Nastya and an Array 答案为非零数的个数。 #include<iostream> #include<cstdio> #include<map> using namespace std; const int N=100005; int n; int a[N]; map< ......
Codeforces Round 992 489 Div

CF996 Codeforces Round 492 (Div. 2) [Thanks, uDebug!]

CF996A Hit the Lottery 直接贪心尽可能的分配到 \(k_5\),剩下的依次分配给 \(k_4,k_3,k_2,k_1\)。 #include<iostream> #include<cstdio> using namespace std; int n; int k[6]; int ......
Codeforces Thanks uDebug Round 996

Codeforces Round 900 (Div. 3) - A B C D E

目录A. How Much Does Daytona Cost?B. Aleksa and Stack A. How Much Does Daytona Cost? 判断数 k 包不包含在数组里面即可 B. Aleksa and Stack 选定初始数为2, 3,后面的遍历 法二:全奇数即可,因为奇 ......
Codeforces Round 900 Div

[题解] Codeforces Round 900(Div.3) E~F

Codeforces Round 900(Div.3) E~F E. Iva & Pav 因为按位与的结果不会随着越多数字的增加而增加,因此我们可以利用这个性质二分出右端点,只需要一个可以查询区间的数据结构即可。 或者是按位考虑第 \(i\) 个数字的第 \(k\) 位,后缀最近的 \(0\) 的位 ......
题解 Codeforces Round 900 Div

Codeforces Round 900 (Div. 3)

昨天晚上生病,没比(血亏) A: 就是看k有没有在序列里 B: 随便放一个大的号码然后加 i,应该就可以过了 C: 就是我们最少要拿 k*(k+1)/2, 最多可以拿 k*(n+n-k+1)/2。 啊,你问我怎么证明在这两个值里就一定可以拿到(当然是猜的!!) D: 让f[x]表示当前出了多少次。然 ......
Codeforces Round 900 Div

Codeforces Round 742 Div2 A-D题解

Codeforces Round 742 Div2 A-D题解 A. Domino Disaster 这题就是说给出一些2x1 tile,然后给出2xn的第一行构造,问第二行 这个刚开始想着是啥dp,一看那么多人过了果断改思路,发现这题就是个模拟题,就是把U换成D,D换成U,L和R不影响,然后输出就 ......
题解 Codeforces Round Div2 742