![](https://img-blog.csdnimg.cn/20210125100653762.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Codeforce
文章平均质量分 56
CF上做过的的题目
青烟dark
这个作者很懒,什么都没留下…
展开
-
E. Are You Fired?
Codeforces Round #645 (Div. 2)题意:一个长度为n的数组,前(n+1)/2个数随机,剩下的数都为x;找一个k,满足 任意长度为 k 的 区间(连续)的和 > 0思路:k > n / 2, 若存在 k < n/2 且满足要求,那么 k * 2 一定满足,小区间都满足了,大区间显然更满足如果 x >= 0:a. 总和 > 0,直接输出n;b. 如果总和 < 0,那么一定不存在;因为 k > n / 2,加了剩下所有原创 2021-09-07 20:30:43 · 121 阅读 · 0 评论 -
D. Yet Another Yet Another Task
Educational Codeforces Round 88 (Rated for Div. 2)题意:定义一个区间的值 = 区间和 - 最大值(重复的只删一次),求给定数组的最大值思路:由于ai很小,可以直接枚举最大值。AC代码:int n; int a[200005];void work(){ cin>>n; for(int i=1;i<=n;++i) cin>>a[i]; int ans=0; for(int i=1;i<=30;++i)原创 2021-09-07 19:25:04 · 103 阅读 · 0 评论 -
Codeforces Round #377 (Div. 2)
B. Cormen — The Best Friend Of a Man题意:给出某人原计划n天内各天遛狗的次数,但是要求任意相邻两天遛狗的次数要不小于k,求需要增加的遛狗的次数思路:dp[i][j] 表示 第i天 遛狗j次。如果某天遛狗次数小于原定计划的次数,则对答案的贡献为0。Code:#define ll long long#define INF 0x3f3f3f3fll n, m, k;ll dp[502][502]; // dp[i][j] 表示 第i天 遛狗j次ll s原创 2021-07-29 11:38:58 · 79 阅读 · 0 评论 -
codeblocks 更改主题 windows
关闭codeblocks软件。下载文件colour_themes.conf(官网,Github)运行cb_share_config程序(codeblocks的安装目录后双击cb_share_config.exe)弹出的面板中,第一个位置打开下载的colour_themes.conf(1),第二个位置打开目标配置文件default.conf(2)(C:\Users\用户名\AppData\Roaming\CodeBlocks)。点击左下角的Transfer>>(3),然后再..原创 2021-07-11 16:20:30 · 1663 阅读 · 0 评论 -
Educational Codeforces Round 109 (Rated for Div. 2)
D. ArmchairsExamplesinput71 0 0 1 0 0 1output3input61 1 1 0 0 0output9input50 0 0 0 0output0思路dp[i][j] 表示 前i个人在前j个椅子中能取到的最小值代码ll n, m;ll s[100005], t[100005], ss, tt;ll dp[5003][5003];#define rep(i, a, b) for(int i=a;i<=b;++i)原创 2021-07-07 20:49:17 · 69 阅读 · 0 评论 -
Codeforces Round #727 (Div. 2)
C. Stable GroupsExamplesinput8 2 31 1 5 8 12 13 20 22output2input13 0 3720 20 80 70 70 70 420 5 1 5 1 60 90output3ll n, k, x;ll s[200005];ll t[200005], cnt;void work(){ cin>>n>>k>>x; for(int i=1;i<=n;++i){ cin>原创 2021-07-03 20:59:56 · 73 阅读 · 0 评论 -
Codeforce Educational Codeforces Round 108 (Rated for Div. 2)
D. Maximum Sum of Productstime limit per test2 secondsmemory limit per test256 megabytesinput standard inputoutpu tstandard outputYou are given two integer arrays a and b of length n.You can reverse at most one subarray (continuous subsegment) of the原创 2021-05-06 16:42:40 · 121 阅读 · 0 评论 -
D. GCD of an Array
D. GCD of an ArrayYou are given an array a of length n. You are asked to process q queries of the following format: given integers i and x, multiply ai by x.After processing each query you need to output the greatest common divisor (GCD) of all elements原创 2021-03-17 21:37:55 · 177 阅读 · 0 评论 -
K-beautiful Strings
You are given a string s consisting of lowercase English letters and a number k. Let’s call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by k. You are asked to find the l原创 2021-03-17 21:19:12 · 211 阅读 · 0 评论 -
CodeForces - 1185D
CodeForces - 1185D题意:删除一个数字使排序后的数组呈等差数列思路:先排序,然后记录差值,然后对于每一个数字都考虑其对差值的影响,如果删除它导致差值的种类减少到1个,即结果。#include <bits/stdc++.h>using namespace std;#define maxn 200005#define show(k) cout<<k<<endlint s[maxn];int ss[maxn];map<int, int&原创 2021-03-07 21:05:48 · 87 阅读 · 0 评论 -
CodeForces - 1442B
题目Exampleinput35 31 2 3 4 53 2 54 34 3 2 14 3 17 41 4 7 3 6 2 53 2 4 5output204Note题意:两行数字,每一行都不存在重复数字;一种操作:任意选择一个数字,然后选择它左边或者右边的一个数字(下标满足 1-n)添加到数组b(初始为空)的最后,之后删掉这个数字(删除后右边的数字依次左移补齐),要求最后获得和第二行数字一样的排列问:一共有多少种方法;思路:首先:对于一个数字a,如果它原创 2021-01-25 10:36:13 · 115 阅读 · 1 评论 -
CodeForces - 1451D
题目Exampleinput52 15 210 325 415441 33outputUtkarshAshishUtkarshUtkarshAshishNote题意:有一个半径为n的圆,有两个人A (Ashish)和U (Utkarsh),A先走,每次可以向上或向左走k的路程问:最后谁不能再继续走了(输出的是赢家)思路想通一件事:你可以在45度的那条线上来回徘徊,类似于楼梯,当走到一个最接近的x 时,输赢就决定了代码#include <ki原创 2021-01-25 10:18:19 · 101 阅读 · 0 评论 -
Codeforce-Gym - 102861L-暴搜
题目Examplesinput4 5XBOICDKIRAALBOABHGES3BOLACASABOIoutput3input3 3AABABABAA2ABABBBoutput3input2 4AAAAAAAA2AAABBBoutput0题意给你一个二维矩阵,里面放着大写字母,给你n个单词(严格来说并不是),你需要在矩阵中找到尽量多的单词块,单词块中的各各字母的个数与其中一个单词相同;问:存在某些小方格,里面的字母被多个(>1)单原创 2021-01-24 22:04:40 · 233 阅读 · 1 评论