ICode9

精准搜索请尝试: 精确搜索
  • Educational Codeforces Round 118 (Rated for Div. 2) D. MEX Sequences2022-05-05 18:02:20

    \(DP\)真的太难了啊!! 首先考虑到\(f(i, s)\)表示,从前\(i\)个数中选,最后一个数为\(a_i\),且\(MEX(a_1,....,a_i) = \left\{ \begin{aligned} a_{i} - 1 (s = 0) \\ a_{i} + 1(s = 1)\end{aligned} \right.\),因为有\(a_i\)的存在,那么\(MEX\)只能取这两种值。 列出方程: \[f(i, a[i] - 1

  • Educational Codeforces Round 126 (Rated for Div. 2)  A-D2022-04-30 08:32:40

    Educational Codeforces Round 126 (Rated for Div. 2) https://codeforces.com/contest/1661 昨天VP的一场 A  Array Balancing 题意 给定两个长度相等的序列a和b,可以交换同一位置上的ai和bi,该操作能进行任意次。问最小的 \[\sum_{i=1}^{n-1}(|a_i-a_{i+1}|+|b_i-b_{i+1}|) \]是

  • [codeforces]第2天2022-04-28 03:03:52

    时间比较晚了,想了想还是得把这个vp搞完,得坚持做下去 今日vp:Educational Codeforces Round 127 (Rated for Div. 2)  A是比较简单的观察,B可以模拟做,C有点思维,需要推下公式,同时注意一个细节:负数的除法是ceil而不是floor,这导致我wa了一发。 D可以从几何考虑,纯思维题,不算太难。 E感觉

  • Educational Codeforces Round 127 (Rated for Div. 2)2022-04-23 12:32:44

    Educational Codeforces Round 127 (Rated for Div. 2) Educational Codeforces Round 127 (Rated for Div. 2) C. Dolce Vita 题意 给定长度为n的序列和一个消耗值m。 每一天序列中每一个元素都会增加1,每一天都可以用m去取序列中的一些数字,并且这些数字之和不超过m,并使得数字个

  • Educational Codeforces Round 127 (Rated for Div. 2) 题解A-E2022-04-23 01:32:16

    A. String Building 长度为\(2\)和\(3\)的可以构造出任何长度大于等于\(2\)的,所以将原序列分割成多段字符相同的极大子串,如果存在长度为1的则无解,反之有解。 B. Consecutive Points Segment 枚举第一个元素,然后就可以贪心了,具体就是\(x_{i - 1}\)确定了,那么把\(x_{i}\)搞成\(x_{i

  • 动态规划:Educational Codeforces Round 123 (Rated for Div. 2)C. Increase Subarray Sums (最大连续区间和)2022-04-15 09:35:19

    C. Increase Subarray Sums 传送门:Problem - 1644C - Codeforces         题目大意就是:给你一个序列,算出序列和为sum,求是否有连续区间和大于等于sum,有就输出NO,否则YES,并且连续区间不能是[1,n],也就是整个序列,我的思路就是构建两个DP数组,既然区间不能是1->n,那么一个dp从1->n-

  • Educational Codeforces Round 125(CF 1657) 简要题解2022-03-28 11:34:53

    CF1657A Integer Moves 题意 给一个点 \((x, y)\) 问从坐标系原点 \((0, 0)\) 出发,每一步走的长度只能是整数,走到 \((x, y)\) 至少要多少步 \(t(t \le 3000)\) 组数据,其中 \(x \le 50, y \le 50\) 且 \(x, y\) 均为整数 题解 \(x \le 50, y \le 50\),就算暴力 \(dp\) 也能过... 然

  • Educational Codeforces Round 121 (Rated for Div. 2)——A - Equidistant Letters2022-03-19 15:35:28

    A - Equidistant Letters 题源:https://codeforces.com/contest/1626/problem/A 今天上午VP了这场CF,很遗憾的是一道题也没写出来,原因是我犯了一些人类难以想象的错误。。。。话不多说先看题 题意 给定一个字符串(全为小写字母),相同的字母最多出现两次。问你可不可以在经过若干次操作

  • Educational Codeforces Round 123 (Rated for Div. 2) E. Expand the Path2022-03-18 22:33:49

    自己没想出来 参考了大佬们的博客 添加链接描述 #include<bits/stdc++.h> #define int long long using namespace std; const int N=200005; int t,n;string s; int32_t main(){ cin>>t; while(t--){ cin>>n>>s; int m=s.size(); int pos

  • Educational Codeforces Round 65 (Rated for Div. 2)2022-02-26 22:35:41

    Educational Codeforces Round 65 (Rated for Div. 2)                A    # include <bits/stdc++.h>    using namespace std;        int main()    {        int t;        scanf("%d",&t);                while(t--

  • Educational Codeforces Round 123 (Rated for Div. 2)(A-D)2022-02-23 17:33:23

    A. Doors and Keys 判读大写字母出现前是否出现过对应的小写字母即可。 B. Anti-Fibonacci Permutation 题意: 构造 n 个满足要求的排列( i ≥ 3 ,

  • Educational Codeforces Round 123 (Rated for Div. 2)2022-02-23 12:31:10

    B. Anti-Fibonacci Permutation 题意 T个样例,每个样例输入一个大于等于3,小于等于50的数, n个数组成一个数组p 输出完全不满足 Pi-1 + Pi-2 = Pi 的n个排序 思路 可以发现如果从n往1递减排序就一定不满足,只需要变换n次1的位置,每次变换完成后输出即可 代码 #include <stdio.h> #

  • Educational Codeforces Round 123 (Rated for Div. 2)2022-02-23 11:00:58

    A 直接按照题意模拟拿钥匙和开门即可…… $\texttt{Code}$ #include<bits/stdc++.h> #define ll long long #define inf (1<<30) #define INF (1ll<<60) #define pii pair<int,int> #define pll pair<ll,ll> #define mkp make_pair #define fi first #define se

  • Educational Codeforces Round 123 (Rated for Div. 2)2022-02-23 02:32:03

    Educational Codeforces Round 123 (Rated for Div. 2) 前言:这场\(CF\)不知道是良心发现还是什么的,突然变简单了(bushi A-Doors and Keys 有\(R,G,B\)三扇门,每扇门对应\(r,g,b\)三把钥匙,钥匙和门按顺序排在一个狭窄的走廊中,只有有了钥匙才能打开对应的门。有\(n\)组询问,每次有一个

  • Educational Codeforces Round 122 (Rated for Div. 2)思路分享2022-02-06 22:35:03

    Educational Codeforces Round 122 (Rated for Div. 2) 明明会的题,却因为手抖,太慌张,多了很多的罚时,要不然又能大涨一波了.... A. Div. 7 修改一个数的某一位,使得它变成7的倍数。首先的想法就是减去余数,但这样的话,可能个位上的数字不足,这样的话会导致借位的情况,所以还有一个情况就

  • Educational Codeforces Round 122 (Rated for Div. 2)2022-02-06 14:05:43

    文章目录 ABCD A 个位从0到9进行枚举,直到能被7整除 #include<bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' const int N=100100; int solve(){ int n; cin>>n; if(n%7==0){ return n; } else { n=n/10*1

  • Educational Codeforces Round 22 E. Army Creation(主席树)2022-02-05 19:01:44

    As you might remember from our previous rounds, Vova really likes computer games. Now he is playing a strategy game known as Rage of Empires. In the game Vova can hire n different warriors; ith warrior has the type a**i. Vova wants to create a balanced ar

  • Atcoder Educational DP Contest 选做2022-02-04 14:31:45

    颓疯了,来做点题恢复一下状态。 刷水题了!!! Educational DP Contest 更好的阅读体验 J Sushi 令 \(f_{a,b,c}\) 为 \(1\) 个寿司的盘子有 \(a\) 个,\(2\) 个寿司的盘子有 \(b\) 个,\(3\) 个寿司的盘子有 \(c\) 个的期望步数。 转移就枚举第一次选中了哪一种寿司,乘个选择的概率,加上个 \(

  • Educational Codeforces Round 122 E. Spanning Tree Queries2022-02-04 13:03:34

    原题链接 题目大意: 可以一张\(n\)个节点\(m\)条边的无向图,对你进行\(k\)次询问,每次询问给你一个值\(x\),让你求出权值\(\displaystyle\sum_{i=1}^{n-1}|w_i-x|\)最小的最小生成树,输出所有询问结果的异或和 题目分析: 求最小生成树,我们首先会想到Kruskal算法来求解,但是询问次数特别多

  • Educational Codeforces Round 121 (Rated for Div. 2) ABC(区间求并)2022-02-03 22:36:02

    A. Equidistant Letters 直接对原字符串进行排序,这样能保证相同的字母相邻,间隔为0. #include <iostream> #include <vector> #include <algorithm> #define pii pair<int,int> #define fi first #define se second #define ll long long using namespace std; int main() { i

  • Educational Codeforces Round 122 (Rated for Div. 2) ABCD2022-02-01 18:03:32

    A. Div. 7 给一个数,问最少修改多少位可以让这个数被7整除。 注意到7小于10,因此每10个数必然有一个7,所以最多只需要修改一次个位即可。 #include <iostream> #include <cmath> #define ll long long using namespace std; int main() { int t; cin >> t; while(t--) { int n;

  • 做题记录2022-02-01 12:32:05

    留个档,看下自己混了多久 2022.1.30 洛谷P4735 最大异或和 [可持久化Trie] Codeforces Round #768 A - C \ D [二分] Codeforces Round #769 A - C \ D [ST表+贪心] Educational Codeforces Round 122 A-C \ D [完全背包+卡常] 2022.2.6

  • Educational Codeforces Round 122 (Rated for Div. 2)2022-02-01 01:00:33

    比赛链接 除夕夜就该打cf 难得a了四题,rk进一千了,新年上大分 A题给你个数,修改它最后一位让它变成7的倍数 #include<bits/stdc++.h> #define N 10000 using namespace std; template <typename T> inline void read(T& x) { x=0;T f=1; char ch=getchar(); while(ch<'0

  • Educational Codeforces Round 122 (Rated for Div. 2)2022-02-01 01:00:06

    A 暴力 #include <bits/stdc++.h> using namespace std; int T, a, b; int main() { cin >> T; while (T -- ) { int n; cin >> n; vector<int> v; while (n) { v.push_back(n % 10); n /= 10; } re

  • Educational Codeforces Round 93 (Rated for Div. 2) C题解2022-01-27 20:06:20

    这个问题的意思就是让你找到一个区间内所有元素和等于区间长度的区间数量。 我们可以先把所有元素先减去1,这样得到的符合条件的区间内元素和0,题意也就变成了找所有和为0区间的数量。若采取暴力做法,题目数据是1e5,时间复杂度是O(n*n)会超时。这时候就要用到stl中的map来优化。 如

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有