educational codeforces string round

Working With Strings In Python.

# 字符串操作 在Python中,`string` 是一种不可变的数据类型,用于表示文本或字符序列,可以使用单引号或双引号将字符串括起来。<font color="#C7EDCC">所有修改和生成字符串的操作的实现方法都是另一个内存片段中新生成一个字符串对象。</font> ## 创建字符串 ``` ......
Working Strings Python With In

Codeforces Round 895 (Div. 3)

Codeforces Round 895 (Div. 3) A. Two Vessels 解题思路: \(d = \lceil {\frac {abs(a - b)} 2}\rceil\) \(ans = \lceil {\frac d c}\rceil\) 代码: #include <bits/s ......
Codeforces Round 895 Div

Codeforces Round 897 (Div. 2)

Codeforces Round 897 (Div. 2) 比赛链接 A. green_gold_dog, array and permutation 题目 给你一个长度为n的数组a,要求你找出一个数组长度为n的数组b,大小是1-n,保证每个数字出现一次,使得a数组与b数组对应位置上的差值和最大。 ......
Codeforces Round 897 Div

Codeforces Round 897 (Div. 2)

F. Most Different Tree 当 \(n=2\) 时,只能构造一条长度为 \(2\) 的链。 当 \(n\ge 3\) 时,对于 \(i\) \((1\le i\le n)\),以 \(i\) 作为根的树记为 \(h_i\),考虑枚举树找一个大小为 \(s\) 的树 \(t\),使得 ......
Codeforces Round 897 Div

Codeforces Round 897 (Div. 2)

Codeforces Round 897 (Div. 2) A. green_gold_dog, array and permutation 分析: 由题意: \[c_i = a_i - b_i \]\(c_i\)种类最多就是\(n\)个数都不同。 若\(a_i\)不断变大,\(b_i\)不断变小, ......
Codeforces Round 897 Div

atcode abc318,codeforce 1861

题目链接 题解 目录AtCoder abc318_a Full MoonAtCoder abc318_b Overlapping sheetsAtCoder abc318_c Blue SpringAtCoder abc318_d General Weighted Max MatchingAtCod ......
codeforce atcode 1861 abc 318

Codeforces Round 897 (Div. 2) A~E

Codeforces Round 897 (Div. 2) A~E A: 原先数组里面最小的位置放最大的数,次小的放次大的即可。 void solve(){ int n; cin>>n; for(int i=1;i<=n;i++){ int x; cin>>x; c[i]={x,i}; } sort ......
Codeforces Round 897 Div

Codeforces Round 896 (Div. 2)

Codeforces Round 896 (Div. 2) A. Make It Zero 代码: #include <bits/stdc++.h> using namespace std; using ll = long long; using i128 = __int128; int n, m; ......
Codeforces Round 896 Div

C#中Math.Round(指定四舍五入)、Math.Ceiling和Math.Floor的用法

1.Math.Round:四舍六入五取偶 Math.Round(17.475728155339805, 2, MidpointRounding.AwayFromZero)=17.48 Math.Round(0.0) //0Math.Round(0.1) //0Math.Round(0.2) //0M ......
Math Ceiling Floor Round

[2022 China Collegiate Programming Contest (CCPC) Guilin Site](https://codeforces.com/gym/104008) CEM

2022 China Collegiate Programming Contest (CCPC) Guilin Site CEM C. Array Concatenation 思路:数学推柿子 考虑有两种操作: 复制 \(b' = \{b_1,b_2,...,b_{|b|},b_1,b_2,..., ......

Python数据类型之字符串(String)

Python 中的变量不需要声明。每个变量在使用前都必须赋值,变量赋值以后该变量才会被创建。 Python中常用的数据类型有6种,分别是:数字(Number)、字符串(String)、列表(List)、元组(Tuple)、字典(Dictionary)、集合(Set)。 字符串(String) Pyt ......
字符串 字符 类型 数据 Python

java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.String

这个问题来自于想把从数据库查询的数据转化为字符串,方便后面做时间比较,显示格式转化错误 sql改造部分 as的左边为我的sql语句 语法使用如下 DATE_FORMAT((sql语句),'%Y-%m-%d %H:%i:%s') 如果是涉及时间的计算,可以考虑如下方式 BigDecimal a = ( ......

【库函数】在什么时候使用 string_view 代替 string

前言 C++17增加了std::string_view,它在很多情况会优于使用std::string 。 尤其是用做函数形参的时候,使用std::string_view基本一定优于老式的const std::string&这种写法。 了解std::string_view 在讲述它的优越性之前,我们应 ......
string string_view 函数 时候 view

$Codeforces Round 897 (Div. 2)$

\(A. green_gold_dog, array and permutation\) 让大的数减小的数就可以制造更多的不同。 PII a[N]; int ans[N]; void solve(){ int n=read(); for(int i=1;i<=n;i++){ a[i]=make_pa ......
Codeforces Round 897 Div

CQBZ Round 12

首先,在本次考试中,我深刻认识到了常数优化的重要性。 我决心改掉 #define int long long 的坏习惯。 我们不能保证评测机的速度,我们只能保证自己代码的优秀。` 同时我要下定决心更改自己的思维方式。 我发现自身在做题时应合理利用时间,创造价值,不能出现T6这种写2.5h没拿一分的情 ......
Round CQBZ 12

CodeForces 542B Duck Hunt

洛谷传送门 CF 传送门 首先转化一下,让鸭子不动,猎人往右移动,就相当于开的相邻两枪距离 \(> m\)。 设 \(f_{x, i}\) 为仅考虑 \(r \le x\) 的鸭子,上一次在 \(i\) 开枪,能打到的最大鸭子个数。 \(f_{x - 1} \to f_x\) 时,首先有 \(f_{ ......
CodeForces 542B Duck Hunt 542

Codeforces Round 896 (Div. 1)

Preface 不管怎么说,最后还是被我苟上橙名了(虽然刚好2100整,不多不少) 感觉我在1900~2100之间卡了好久好久,反观我的队友都是打上紫名后随便两三场就打上橙了,狠狠地羞辱我这个铁混子 由于暑假集训打的校内排名比较高,作为新队伍也拿到了今年的一场CCPC+一场ICPC的名额,虽然要自费 ......
Codeforces Round 896 Div

SICTF-2023 round2

前言 又是挺长一段时间没有打ctf了,各种原因,要过一段时间才会继续上强度学安全吧QAQ。这个SICTF是被朋友拉过来打的,看了一下,还是挺有意思的。下面记录下题目,以及复习到的一些知识点吧。笔者真的是脑子不好使了 签到Shop 很简单的签到题目,算是一个整型溢出的类型。 Different_gad ......
round2 SICTF round 2023

Codeforces Round 101 (Div. 2) C - E

C. Queue (思维、排序、构造、*1800) 题意:$ n $ 个人排队, 为他们构造一组身高, 使得 $ x $ 的前面有 $ a_i $ 个人比他高。如果无法构造满足所有条件的身高序列, 输出 -1。 思路:首先考虑, 对于 $ a_i $ 较大的人, 肯定尽可能地将其往队伍后面放, 然后 ......
Codeforces Round 101 Div

Codeforces Round 896 (Div. 2) A-D2

A. Make It Zero 没看懂这个 8 次的限制是什么意思。先用一次直接把所有数变成 \(\oplus_{i=1}^n a_i\),如果 \(n\) 是偶数直接 \([1,n]\) 做完,如果是奇数先把 \([1,n-1]\) 变成 0,再做两遍 \([n-1,n]\) 即可。 点击查看代码 ......
Codeforces Round 896 A-D Div

【题解】Educational Codeforces Round 142(CF1792)

没有手速,再加上被 E 卡了,废掉了。 A.GamingForces 题目描述: Monocarp 正在玩电脑游戏。他打算杀死 \(n\) 个怪兽,第 \(i\) 个的血量为 \(h_i\)。 Monocarp 的角色有两个魔法咒语如下,都可以以任意顺序用任意次(可以不用),每次使用相当于一次操作。 ......
题解 Educational Codeforces Round 1792

Codeforces Round 895 (Div. 3)

Codeforces Round 895 (Div. 3) A - Two Vessels 思路:找到差值,让a,b向中间靠 #include<bits/stdc++.h> using namespace std; #define int long long //#define int __int1 ......
Codeforces Round 895 Div

SMU Autumn 2023 Round 2(Div.1+2)

SMU Autumn 2023 Round 2(Div.1+2) C. Chaotic Construction 把环展开的话就是\(1 \sim 2n\),若\(D\)的位置放上路障的话,在这个展开的环上就是\(D\)和\(D+n\)的位置,对于\(x,y\),我们就是去看\(D\)或者\(D+n ......
Autumn Round 2023 SMU Div

Codeforces Round 798 (Div. 2) B. Mystic Permutation

给一个长为 \(n\) 的排列 \(p\) ,需要构造一个长为 \(n\) 的排列 \(q\) ,满足 \(\forall i, p_i \neq q_i\) ,且 \(q\) 在所有合法排列中字典序最小。 观察一:\(n = 1\) 时无解,否则有解。 观察二:\(n > 1\) 时,\(1 \s ......
Permutation Codeforces Mystic Round 798

Codeforces Global Round 21 B. NIT Destroys the Universe

给一个长为 \(n\) 的数组,可以执行以下操作任意次: 选择 \(l, r(1 \leq l < r \leq n)\) ,让 \(\forall i(l \leq i \leq r), a_i = mex(\{a_l, a_{l+1}, \cdots, a_{r}\})\) 。 问最小操作数使得 ......
Codeforces Destroys Universe Global Round

SICTF-2023 #Round2-WP-Crypto | Misc

💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌 ......
Round2-WP-Crypto Crypto Round2 SICTF Round

Educational Codeforces Round 132 (Rated for Div. 2) B. Also Try Minecraft

一个世界地图用一个长为 \(n\) 的数组表示,\(a_i\) 代表坐标 \(i\) 的高度。若下一块区域的高度为 \(y\) ,当前区域的高度为 \(x\) ,则一次行走会受到 \(max(y - x, 0)\) 点下落伤害。 有 \(q\) 个询问,每个询问独立,给定起点和终点坐标 \(s, t ......
Educational Codeforces Minecraft Round Rated

String Transformation

String Transformation You are given two strings s and t of equal length n. You can perform the following operation on the string s: Remove a suffix of ......
Transformation String

【题解】CF1830C Hyperregular Bracket Strings

我们知道,一个长度为 \(n\) 的合法括号序列的种数就是第 \(\frac n 2\) 个卡特兰数(当然 \(n\) 是奇数答案肯定就是 \(0\)) 我们可以发现一件事情,如果两个区间相互包含,那么就可以将大区间分为中间被包含的小区间的部分和外面没有被小区间覆盖的部分。 如果两个区间相交,那么就 ......
题解 Hyperregular Bracket Strings 1830C

Educational Codeforces Round 130 (Rated for Div. 2) B. Promo

有 \(n\) 件商品,第 \(i\) 件的价格是 \(p_i\) ,若买至少 \(x\) 件商品,则其中最便宜的 \(y\) 件免费。给 \(q\) 个询问,每次给出 \(x, y\) ,回答最多能免费的价值。 按大到小排序,求前缀和 \(S_{i}\) 表示买前 \(i\) 件商品需要的开销。 ......
Educational Codeforces Round Rated Promo