educational codeforces string round

java.lang.NumberFormatException: Cannot parse null string问题的解决

# 问题描述 直接从jsp页面使用超链接到servlet后台界面,就出现了这个问题 # 问题解决 是我直接略过了某个jsp页面,然后直接在servlet里面进行获取信息**String id=req.getParameter("id");** 然后在前一个jsp页面没有出现这个名为id的输入框,就出 ......

Codeforces[CF1036B]Diagonal Walking v.2题解

# 题目大意 很明显,这道题就是求 k 步之内到达点 $(a,b)$ ,然后尽量走对角线,求能走对角线的最大值。 # 做题思路 首先明白一个事实,即一个对角线可以通过增加一步而抵达点不变,如图: ![image](https://img2023.cnblogs.com/blog/3175066/20 ......
题解 Codeforces Diagonal Walking 1036B

Python - Ridiculous Rounding

Python 3 uses “Banker’s Rounding” which is defined like this: “Exact halfway cases are now rounded to the nearest even result instead of away from zer ......
Ridiculous Rounding Python

Invalid prop: type check failed for prop "closeOnClickModal". Expected Boolean, got String with valu

element 的弹出框dialog问题,点击页面的别的地方是,弹出框不关闭 close-on-click-modal设成false即可,但是在<el-dialog close-on-click-modal="false"></el-dialog> 报上述错误 应该这样写<el-dialog :cl ......
closeOnClickModal prop quot Expected Invalid

CodeTON Round 5 (Div. 1 + Div. 2, Rated, Prizes!) D. Tenzing and His Animal Friends

题面是真的抽象,翻译为人话之后大概就是,对于每个选择的集合当中,1必须选,n一定不能选,每个限制条件的意思是如果u和v不在一个集合里则最能玩y时间,则u或v独自玩最多玩y时间 如果在同一集合则可以玩无限时间 因此如果n和1不连通的话则一定为inf,否则的话就一定有限制,因为n一定不能选,则和n相连的 ......
Div CodeTON Friends Tenzing Animal

Codeforces Round 881 (Div. 3)

~~失踪人口回归~~ VP 打的 ### A. Sasha and Array Coloring ``` int n; int a[maxN]; void solve(){ n=rd(); fp(i,1,n) a[i]=rd(); sort(a+1,a+n+1); ll ans=0; for(int ......
Codeforces Round 881 Div

Codeforces 1648F - Two Avenues

为啥会有人觉得这是板子题啊/tuu 先对图边双连通分量缩个点,然后考虑对两条边分情况讨论: - 两个桥边,显然答案就是经过这两个桥的路径数量之和,排序取前两大的即可。 - 一个桥边加一个非桥边,答案是经过那个桥边的路径数量,显然桥边数量 $\ge 2$ 肯定不用考虑这种情况,桥边数量 $=1$ 另外 ......
Codeforces Avenues 1648F 1648 Two

[LeetCode] 1071. Greatest Common Divisor of Strings

For two strings s and t, we say "t divides s" if and only if s = t + ... + t (i.e., t is concatenated with itself one or more times). Given two string ......
LeetCode Greatest Divisor Strings Common

CodeForces 605E Intergalaxy Trips 题解

## 题意 > 有一张 $n$ 个点的有向完全图,边 $i \to j$ 有 $p_{i,j}$ 的概率出现($p_{i,i}=1$)。你要从 $1$ 开始,每天可以走一条出边或留在原地,求最优策略下走到 $n$ 的期望天数。输出小数(不取模)。 > $n \le 10^3$ ## 思路 设 $f( ......
题解 Intergalaxy CodeForces Trips 605E

SMU Spring 2023 Contest Round 7

A. Programming Contest 签到题. 输入输出读完应该就懂了: 从y1枚举到y2,若枚举的年份不在停办年份里则答案加一 void solve() { int n,m; cin >> n; vector<int> a(N),year(N); cin >> m; for(int i = ......
Contest Spring Round 2023 SMU

CodeTON Round 5 (Div. 1 + Div. 2, Rated, Prizes!) C. Tenzing and Balls

一开始以为是贪心,后来发现不好贪于是选择了dp,但是dp有个小细节没注意到,后面wa了几发 我们以状态来分,f[i]表示考虑i的最大区间合长度,每次转移的时候考虑两种情况,一种是a[i]前面有一样的数字,比较选了a[i]和不选a[i]两种情况下的最大值,还有一种就是a[i]为第一个出现的数字则选区间 ......
Div CodeTON Tenzing Prizes Balls

Codeforces 1787H - Codeforces Scoreboard(平衡树优化 dp)

令 $c_i=b_i-a_i$,等价于我们钦定一个排列 $p$,最小化 $\sum \min(p_ik_i,c_i)$,拿 $\sum b_i$ 减去之就是答案。 我们钦定一些 $i$ 满足 $p_ik_iY.k;} }a[MAXN+5]; struct node{int ch[2],siz,key ......
Codeforces Scoreboard 1787H 1787

CF Round 881 (Div. 3)

# CF Round 881 (Div. 3) > Div. 3 果然简单,虽然但是,我还是有 1 道题没有想出来。 ## A.Sasha and Array Coloring 排序双指针向内即可。 ## B.Long Long > 好啊,就是这道题没想出来。 `Virtual Contest` 上 ......
Round 881 Div CF

Educational Codeforces Round 150 (Rated for Div. 2) A-E

[比赛链接](https://codeforces.com/contest/1841) # A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n; cin >> n; if (n ......
Educational Codeforces Round Rated 150

CodeForces 1842E Tenzing and Triangle

[洛谷传送门](https://www.luogu.com.cn/problem/CF1842E "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1842/problem/E "CF 传送门") 一个很显然的观察:选择的三角形两两重叠面积为 $0$, ......
CodeForces Triangle Tenzing 1842E 1842

CodeForces 1842G Tenzing and Random Operations

[洛谷传送门](https://www.luogu.com.cn/problem/CF1842G "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1842/problem/G "CF 传送门") 原来还不会这种拆期望的套路![](//图.tk/0) ......
CodeForces Operations Tenzing Random 1842G

string类的实现

- string类实现的演变 - eager-copy(深拷贝) - cow-copy(写时复制) - sos(短字符串优化) - 最佳策略 以上三种方式,都不能解决所有可能遇到的字符串的情况,各有所长,又各有缺陷。综合考虑所有情况之后,facebook开源的folly库中,实现了一个fbstrin ......
string

CodeForces 1842F Tenzing and Tree

[洛谷传送门](https://www.luogu.com.cn/problem/CF1842F "洛谷传送门") [CF 传送门](https://codeforces.com/contest/1842/problem/F "CF 传送门") 事实上自己方向一直是错的…… 绝对值不好弄,我一开始的 ......
CodeForces Tenzing 1842F 1842 Tree

C++面试八股文:std::string是如何实现的?

# C++面试八股文:std::string是如何实现的? 某日二师兄参加XXX科技公司的C++工程师开发岗位第18面: > 面试官:`std::string`用过吧? > 二师兄:当然用过(废话,C++程序员就没有没用过`std::string`的)。 > 面试官:`std::string("he ......
八股文 八股 string std

Codeforces Round 875 (Div. 2) C. Copil Copac Draws Trees

bfs解法 如果是暴力求解的话就每次都扫描一次所有边直到所有点都和树连接 优化:每次扫描我们可以发现会重复扫描那些已经存在树中的边了,因此我们可以只扫描还没有存在树中的边且是没扫过的边 对于每次更新,比如由点a已经在树中,更新点b,我们只需判断点a被更新到树中点的编号和a-b边的编号的大小,如果比它 ......
Codeforces Round Copil Copac Draws

redis-string常用命令

string类型的常用命令 常用SET/GET SET k1 v1 EX参数:以秒为单位设置过期时间 set k2 v2 EX 10 PX参数:以毫秒为单位设置过期时间 set k2 v2 PX 10000 EXAT参数:设置以秒为单位的UNIX时间戳所对应的时间为过期时间 PXAT参数:设置以毫秒 ......
redis-string 命令 常用 string redis

Codeforces Round #879 (Div. 2) A-E

[比赛链接](https://codeforces.com/contest/1834) # A ## 代码 ```c++ #include using namespace std; using ll = long long; bool solve() { int n; cin >> n; int c ......
Codeforces Round 879 A-E Div

SMU Spring 2023 Contest Round 6

E. Expenditure Reduction 从左右往右找到包含B字符的最近位置,然后从这个位置有从右到左找回去找到包含完所有B字符的位置,这个区间就是答案 #include <bits/stdc++.h> #define inf 0x3f3f3f3f #define endl '\n' #de ......
Contest Spring Round 2023 SMU

B. Reverse Binary Strings

You are given a string $s$ of even length $n$. String $s$ is binary, in other words, consists only of 0's and 1's. String $s$ has exactly $\frac{n}{2} ......
Reverse Strings Binary

Codeforces Round 781 (Div. 2) E. MinimizOR (可持久化字典树)

[传送门](https://codeforces.com/contest/1665/problem/E) 题目大意: ** T组测试数据每组测试数据先输入一个n表示有一个长度为n的一维数组,然后输入n个数字表示这个一维数组。紧接着输入一个k表示有k个询问,对于每个询问会输入一个l和一个r表示询问数组 ......
字典 Codeforces MinimizOR Round 781

Codeforces Round 881 (Div

## E. Tracking Segments >给定初始长度为`n`,且全为`0`的序列`a`,然后给出`m`个线段,如果一个线段中`1`的个数严格大于`0`的个数,那么该线段称为一个漂亮线段,现在给出`q`次操作,每次操作使得序列`a`中位置`x`上的`0`变为`1`,请你求出第一次使得所有线段 ......
Codeforces Round 881 Div

Codeforces 1603D. Artistic Partition

题目链接:[D - Artistic Partition](https://codeforces.com/contest/1603/problem/D "D - Artistic Partition") 题目大意:要求将 $[1,n]$ 分成 $k$ 段,使得每段对应的 $c(l,r)$ 之和最小, ......
Codeforces Partition Artistic 1603

Codeforces Round 877 (Div. 2)A-D

Codeforces Round 877 (Div. 2)A-D A: 有负数就输出,没有就输出最大值即可。 void solve(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } sort(a+1,a+1+n); if(a[1]<0){ c ......
Codeforces Round 877 A-D Div

string类型可以作为lock的锁对象吗

## lock 关键字介绍 lock 关键字是用于在多线程编程中实现同步和互斥访问的关键字。它的作用是确保共享资源在任意时刻只能被一个线程访问,从而避免出现竞态条件(race condition)和数据不一致的问题。 当多个线程同时访问共享资源时,如果没有合适的同步机制,可能会导致数据损坏、结果的不 ......
对象 类型 string lock

Codeforces Round 766 (Div. 2) 比赛报告

## 0 比赛经过 比赛还没开始的时候就感觉状态不太好。果然。 总归到底都是一个心态问题。 ### A 题经过 看 A 题,结果**半天看不懂,一开始没有注意到一定要在黑格子上操作**。扔到 DeepL 上翻译了一下,再手玩一下样例就做出来了,速度有点慢。CF 怎么这么喜欢出分讨题啊。 看题目不能太 ......
Codeforces 报告 Round 766 Div