codeforces operations array round

Codeforces Round 916 (Div. 3) (A~E2)

A. Problemsolving Log 签到题,对于给出的字符串,用数组记录每个字母出现的次数,然后遍历一边记录数组,如果对应的字母出现次数大于它的位次,则说明该字母对应的题目被解出来了,最后输出解题数量即可 void solve() { int n; cin >> n; string s; c ......
Codeforces Round 916 Div E2

[Codeforces] CF1795C Tea Tasting

CF1795C Tea Tasting 题意 有 \(n\) 个人和 \(n\) 杯茶,第 \(i\) 个人每次会喝 \(b_i\) 毫升的茶。第 \(i\) 杯茶有 \(a_i\) 毫升。总共会喝 \(n\) 轮茶,第 \(j\) 轮第 \(i\) 个人会尝试喝第 \(i+1-j\) 杯茶。喝的量 ......
Codeforces Tasting 1795C 1795 Tea

D. Array Collapse

D. Array Collapse You are given an array $[p_1, p_2, \dots, p_n]$, where all elements are distinct. You can perform several (possibly zero) operations ......
Collapse Array

Educational Codeforces Round 160 (Rated for Div. 2) 题解A~D

Educational Codeforces Round 160 (Rated for Div. 2) A. Rating Increase 纯暴力,分割字符串,如果n1<n2就输出,如果遍历完整个数组都不存在n1<n2就输出-1. const int N = 2e5 + 10; int toint ......
题解 Educational Codeforces Round Rated

Educational Codeforces Round 160 (Rated for Div. 2) A~C

A. Rating Increase 题意: 将一个字符串分成两个整数a和b,要求没有前导0,且a < b 思路: 遍历字符串s,若当前位置不是0,则拆分字符串,比较大小 // #include <bits/stdc++.h> #include <iostream> #include <string ......
Educational Codeforces Round Rated 160

Educational Codeforces Round 160 (Rated for Div. 2)

基本情况 A题秒了。 B题卡了实在太久,BC题最后虽然都过了,但是耗时太久。感觉C对我来说更好写。 B. Swap and Delete 经典+3。 总是一条路偏要走到黑了才会想着换思路,早该换了。 一开始想了一大堆乱七八糟的思路,但都错了。 后面往简单了想,这题毕竟最后必须要左对齐的,直接从左往右 ......
Educational Codeforces Round Rated 160

Queries for the Array 题解

前言 这场 CF 是我赛后打的,vp 赛时没做出来,后来发现是有个地方理解错了,有一些细节没有考虑到。现在换了一种思路来写,感觉更清晰了。 做法 首先需要动态维护三个变量,\(cnt\) 和 \(finishsort\) 和 \(unfinishsort\)。这三个变量分别表示当前数字的个数,已经排 ......
题解 Queries Array for the

Cyclic Operations 题解

前言 看这道题有好多巨佬都是用 Tarjan 来做的,在这里讲一个自认为比较简单的做法,(不到 \(30\) 行)。 题意 题意比较难讲,建议自己去看一下翻译,在这里不多赘述。 思路 首先看到题目中间给的一个每一次操作的式子:\(a_{l_{i}}=l_{(i\mod k)+1}\)。仔细观察这个式 ......
题解 Operations Cyclic

C++ 反向遍历 array 小记

有时候需要逆向循环,例如从字符串的最右端遍历到最左端,需要注意一些细节!初学遇到一些 bug 记录在这里。 首先 arr.size() 的数据类型为 size_t,为无符号整型 对于 for (int idx = arr.size() - 1; idx >= 0; idx--): 使用 int 作为 ......
小记 array

【Optimization in Operations Research 运筹学】牛顿法、高斯牛顿法、拟牛顿法与BFGS与为什么H要正定牛顿法亮点与弊端

牛顿法 \(F(x+\Delta x)=F(x)+F'(x)\Delta x+\frac{1}{2}F''(x)\Delta x^2\) 泰勒展开之后保留二次项 然后对展开式再进行求导 令导数等于0 直接得到前进的步长和方向 即\(Hx = b\)这里的\(x\)就是牛顿法求解的前进步长和方向。 如 ......

【题解】CodeForces-1913

CodeForces-1913A Rating Increase 依题意模拟。 提交记录:Submission - CodeForces CodeForces-1913B Swap and Delete 交换免费就是能任意重排,从头开始尽量填相反的,剩下只能删去了。 提交记录:Submission ......
题解 CodeForces 1913

【题解】CodeForces-1905

CodeForces-1905A Constructive Problems 发现沿着对角线放就行了,答案是 \(\max(n+m)\)。 提交记录:Submission - CodeForces CodeForces-1905B Begginer's Zelda 最优操作每次删两个叶子(除了最后一 ......
题解 CodeForces 1905

Educational Codeforces Round 160 (Rated for Div. 2)

比赛录屏 \(A. Rating Increase\) https://codeforces.com/contest/1913/submission/237734923 \(B. Swap and Delete\) https://codeforces.com/contest/1913/submis ......
Educational Codeforces Round Rated 160

Educational Codeforces Round 160

总结 被edu撅飞力 只会前三题,掉绿指日可待 我这种彩笔还是不适合div.2 A 直接模拟,注意细节 #include<bits/stdc++.h> #define ll long long using namespace std; ll p[15] = {1}; void solve() { l ......
Educational Codeforces Round 160

关于奇怪的 Array 函数:

关于奇怪的 Array 函数: 众所周知,我们可以通过Array函数来做以下事情。 初始化一个指定长度的数组。 设置数组的初始值。 // 1. Initialize an array of the specified length const array1 = Array(3) // [ , , ] ......
函数 Array

Educational Codeforces Round 132 (Rated for Div. 2)

基本情况 AB秒了。C跨度有点太大,题解暂时都还没理解。 C. Recover an RBS Problem - C - Codeforces 待补题 ......
Educational Codeforces Round Rated 132

CF Round 906 (Div. 1)

CF Round 906 (Div. 1) C. Doremy's Drying Plan (√2000 / *2600) Easy ver. 可以得出只有被覆盖 1 / 2 次的才能被消除。 覆盖一次枚举线段,覆盖两次枚举点。 Hard ver. D. Game of Stacks (*3000) ......
Round 906 Div CF

Array数组常用方法

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <script> var arr = [1,2,3,4] //push 后面追加元素 //返回值 长度 var res = arr. ......
数组 常用 方法 Array

Codeforces Round 834 (Div. 3)

Codeforces Round 834 (Div. 3) A. Yes-Yes? 题意:就是Y后面跟e,e后面跟s,s后面跟Y #include <iostream> using namespace std; void solve() { string x; cin >> x; int l = x ......
Codeforces Round 834 Div

Codeforces Round 839 (Div. 3)

Codeforces Round 839 (Div. 3) A. A+B? 跳过太水了、、、、、 #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a,b; sc ......
Codeforces Round 839 Div

Educational Codeforces Round 131 (Rated for Div. 2)

基本情况 AB秒了。C知道是二分答案,check死活写不出来。 C. Schedule Management Problem - C - Codeforces 错误分析 这题比较绕,搞了一个对应关系,大脑转不过来。 写check的时候完全想不出合理的思路。 很明显的要用桶来计数,但是怎么用不知道了。 ......
Educational Codeforces Round Rated 131

Educational Codeforces Round 159 (Rated for Div. 2)

Educational Codeforces Round 159 (Rated for Div. 2) A - Binary Imbalance 解题思路: 有一对\((0,1)\),那么\(0\)就能无限增长。 代码: #include <bits/stdc++.h> using namespac ......
Educational Codeforces Round Rated 159

Codeforces Round 915 (Div. 2)

基本情况 A题还没进入状态,卡了快10分钟。 B题一开始想复杂了,以为是树的直径,后面推出来发现针对叶子数目讨论就行了,正确思路出来太慢了(一个半小时)。 C题留了半个多小时,随便口胡了一个LIS思路,但是判断无解没思路。 C. Largest Subsequence Problem - C - C ......
Codeforces Round 915 Div

牛客周赛 Round 24

牛客周赛 Round 24 比赛地址 最后一题没想到用二分做,可惜可惜,思考的方向错了 A 小红的矩阵构造 题目链接 思路: 主要是区分一下n是奇数还是偶数,是奇数的话就正常输出就行,是偶数的话就可以把偶数行逆着输出 代码: #include<bits/stdc++.h> using namespa ......
Round 24

Educational Codeforces Round 134 (Rated for Div. 2)

基本情况 AB秒了。 C搞了一个错的二分答案,虽然过样例了。 C. Min-Max Array Transformation 错误分析 没有进一步推导性质,而是觉得数据单调递增估计是二分,然后就无脑写,实际上 check 的正确性没有保证。 bool check(int ind, int now) ......
Educational Codeforces Round Rated 134

python 浮点数 round 舍一法 向零取整 df 数组 Series 三种数据类型实现

介绍:python的round函数,默认进行四舍五入,我需要将3.45 保留一位小数,3.4 一、一般格式 使用 Python 的内置函数 math.floor() 来向下取整到指定的小数位数。例如,如果你想保留小数点后一位并向下取整,可以这样做: import math num = 3.45 ro ......
数组 点数 类型 数据 python

Codeforces Round 817 (Div. 4)

基本情况 ABCD秒了。 E一眼二位前缀和,但是板子就是不熟,硬生生拖了半小时。 E. Counting Rectangles Problem - E - Codeforces 真没啥好说的 二位前缀和就是不熟练、不透彻。 挂篇博客复习 ......
Codeforces Round 817 Div

Codeforces Round 855 (Div. 3)

Codeforces Round 855 (Div. 3) A. Is It a Cat? 题意:要求: 字符串必须以只包含字母 "m "或 "M "的非空序列开始 必须紧跟由'e'或'E'字符组成的非空序列 必须紧接着仅由字符'o'或'O'组成的非空序列 必须紧接着是仅由字符'w'或'W'组成的非 ......
Codeforces Round 855 Div

Codeforces Round 863 (Div. 3)

Codeforces Round 863 (Div. 3) A. Insert Digit 题意:插入一个字母使得这个数字最大化 思路:只要从前往后便利就行 #include <iostream> using namespace std; void solve() { int n, k; cin > ......
Codeforces Round 863 Div

Codeforces Round 913 (Div. 3)

Codeforces Round 913 (Div. 3) A:ABC A. Rook 简单题,就两个循环搞定(直接上码) #include <bits/stdc++.h> using namespace std; void solve() { char a; int b; cin >> a >> ......
Codeforces Round 913 Div
共3000篇  :6/100页 首页上一页6下一页尾页