educational codeforces string round

CF957 Codeforces Round 472 (rated, Div. 2, based on VK Cup 2018 Round 2)

CF957A Tritonic Iridescence 如果原序列中有两个相同的字符,显然不合法。 如果开头或者结尾为 ?,或者有两个连续的 ?,或者一个 ? 两边的字符不同显然合法。 否则一定不合法。 #include<iostream> #include<cstdio> using namesp ......
Round Codeforces rated based 2018

CF992 Codeforces Round 489 (Div. 2)

CF992A Nastya and an Array 答案为非零数的个数。 #include<iostream> #include<cstdio> #include<map> using namespace std; const int N=100005; int n; int a[N]; map< ......
Codeforces Round 992 489 Div

CF996 Codeforces Round 492 (Div. 2) [Thanks, uDebug!]

CF996A Hit the Lottery 直接贪心尽可能的分配到 \(k_5\),剩下的依次分配给 \(k_4,k_3,k_2,k_1\)。 #include<iostream> #include<cstdio> using namespace std; int n; int k[6]; int ......
Codeforces Thanks uDebug Round 996

Codeforces Round 900 (Div. 3) - A B C D E

目录A. How Much Does Daytona Cost?B. Aleksa and Stack A. How Much Does Daytona Cost? 判断数 k 包不包含在数组里面即可 B. Aleksa and Stack 选定初始数为2, 3,后面的遍历 法二:全奇数即可,因为奇 ......
Codeforces Round 900 Div

[题解] Codeforces Round 900(Div.3) E~F

Codeforces Round 900(Div.3) E~F E. Iva & Pav 因为按位与的结果不会随着越多数字的增加而增加,因此我们可以利用这个性质二分出右端点,只需要一个可以查询区间的数据结构即可。 或者是按位考虑第 \(i\) 个数字的第 \(k\) 位,后缀最近的 \(0\) 的位 ......
题解 Codeforces Round 900 Div

2023.9.27 LGJ Round

A 已知一个字符串 \(n\le 1e3\) 中的若干信息,:\((x,y,z)\) 表示 \(x\) 后缀和 \(y\) 后缀的 \(\text{LCP}=z\). 求满足条件的字典序最小的字符串。 已知 \(a_{x+i}=a_{y+i}(i<z)\),考虑维护并查集,一定相同的在一个集合。 然 ......
Round 2023 LGJ 27

How to add a string that contains whitespace to array in shell script All In One

How to add a string that contains whitespace to array in shell script All In One ......
whitespace contains string script array

Codeforces Round 900 (Div. 3)

昨天晚上生病,没比(血亏) A: 就是看k有没有在序列里 B: 随便放一个大的号码然后加 i,应该就可以过了 C: 就是我们最少要拿 k*(k+1)/2, 最多可以拿 k*(n+n-k+1)/2。 啊,你问我怎么证明在这两个值里就一定可以拿到(当然是猜的!!) D: 让f[x]表示当前出了多少次。然 ......
Codeforces Round 900 Div

Codeforces Round 742 Div2 A-D题解

Codeforces Round 742 Div2 A-D题解 A. Domino Disaster 这题就是说给出一些2x1 tile,然后给出2xn的第一行构造,问第二行 这个刚开始想着是啥dp,一看那么多人过了果断改思路,发现这题就是个模拟题,就是把U换成D,D换成U,L和R不影响,然后输出就 ......
题解 Codeforces Round Div2 742

9.26 SMU Autumn 2023 Round 5

SMU Autumn 2023 Round 5 A - Everyone Loves to Sleep 思路:将小于睡觉时间的闹钟加24:00,找到最小的时间min,答案即为min-睡觉时间 #include<bits/stdc++.h> using namespace std; //#define ......
Autumn Round 9.26 2023 SMU

Codeforces Round 899 (Div. 2)

Preface 好久没现场打CF了(玩CC玩的.jpg),但这场久违的打的还不错,把Kusanagi_Misuzu这个小号也打上橙了 虽然开场的时候状态不佳写的巨慢,但后面还是靠着ztc带我做出E1成功题数反超上大分 接下来要考虑启动第三个小号了,只敢打Div2的FW是这样的 A. Increasi ......
Codeforces Round 899 Div

CODE FESTIVAL 2017 Elimination Tournament Round 3 F Unicyclic Graph Counting

洛谷传送门 AtCoder 传送门 看到和度数有关的(基环)树计数,可以想到 Prufer 序。 如果要计数一棵树,那么答案就是 \(\binom{n - 2}{d_1 - 1, d_2 - 1, \ldots, d_n - 1}\)。因为度数为 \(d\) 的点在 Prufer 序中恰好出现 \( ......

UOJ NOI Round #6

没什么好说的,一题不会。 D1T1. 面基之路 考虑瓶颈在于最后一个网友的面基时间。 Trick:可以看作 所有网友都在同一时间(显然一定也是同一位置)面基,因为各个网友和 hehe 桑本人都是独立行动,而且可以原地不动。 也就是求一个最快的集合点(包括顶点和各边的中点)。直接边转点,枚举最短路之和 ......
Round UOJ NOI

Codeforces Round 738 (Div. 2) A. Mocha and Math

给一个数组 \(a_1, a_2, \cdots, a_n\) 。可以执行以下操作任意次: 选择 \(l, r (1 \leq l < r \leq n)\) ,对于任意 \(l \leq i \leq r\) ,同时执行所有 \(a_{l + i} = a_{l + i} \& a_{r - i} ......
Codeforces Round Mocha Math 738

Codeforces Round 899 (Div. 2) 记录

Codeforces Round 899 (Div. 2) A. Increasing Sequence 点击查看代码 #include<bits/stdc++.h> using namespace std; const int maxn=105; int t,n; //map<int,bool> ......
Codeforces Round 899 Div

SMU Autumn 2023 Round 5

SMU Autumn 2023 Round 5 A. Everyone Loves to Sleep 把时间都转成分钟,然后存起来,二分找到离他睡觉点最近的一个时间段,减去他的睡觉点,如果最近的在第二天,则把中间的这段时间加起来 #include <bits/stdc++.h> #define in ......
Autumn Round 2023 SMU

Codeforces Round 898 (Div. 4)

这是我的vp,不是正真的contest. A: 不想多说,读者应该可以做到的!!! B: 让g=product(移除掉0的a): 如果有多过1个0答案肯定是0。 如果只是有1个0答案就是g。 没有0,答案就是max(g/a[i]*(a[i]+1)) 任何 i。 C: 没有仔细想那个profit的fo ......
Codeforces Round 898 Div

Codeforces Round 899 (Div. 2)

赛后四题 B题直接枚举不存在的元素即可 C题的trick有点像之前abc的某道题,对于奇数位置它一定可以贡献,对于偶数位置,如果它有数选了,那么它就能够贡献。 \(f[i]\)表示到前i个且至少选了一个的最大答案。 #include<cstdio> #include<algorithm> #incl ......
Codeforces Round 899 Div

Codeforces Round 738 (Div. 2) B. Mocha and Red and Blue

给一个字符串,包含字符 \(B\) , \(R\) ,\(?\) 。其中 \(?\) 可能为 \(B\) 或 \(R\) 。 规定不完美数为字符串中相同字符连续出现的次数,询问一个字符串的最少可能不完美数。 观察到 \(BR\) 或 \(RB\) 需要尽可能多,于是考虑尽可能让相邻字符不同。 容易证 ......
Codeforces and Round Mocha Blue

Java8对List<Map<String,String>>中元素排序降序

import java.util.*; public class Main { public static void main(String[] args) { List<Map<String, Object>> list = new ArrayList<>(); Map<String, Long> ......
String 元素 Java8 Java List

Codeforces Round 750 (Div. 2) B. Luntik and Subsequences

给一个数组 \(a_1, a_2, \cdots, a_n\) ,定义 \(s = \sum_{i = 1}^{n} a_i\) 。 询问有多少个 \(a\) 的子序列满足 \(\sum a_{i_k} = s - 1\) 。 显然要选出一个 \(1\) 不加入子序列,任意一个 \(0\) 可以加入 ......
Subsequences Codeforces Luntik Round 750

Technocup 2022 - Elimination Round 2 Two Arrays

给定两个数组 \(a_1, a_2, \cdots, a_n\) 和 \(b_1, b_2, \cdots, b_n\) 。 定义 \(a\) 的一次操作: 选择任意一个非负整数 \(k(0 \leq k \leq n)\) 。 选择任意 \(k\) 个独立的下标 \(i_1 \leq i_2 \l ......
Elimination Technocup Arrays Round 2022

Technocup 2022 - Elimination Round 3 B. Array Eversion

给一个长度为 \(n\) 的数组。执行一次以下操作: 让 \(x = a_n\) ,然后数组 \(a\) 被分为左右两部分。左部分包含所有 \(\leq x\) 的元素,右部分包含所有 \(> x\) 的元素。且数组整体的原顺序不变。 询问经过多少次操作后,数组不再改变? \(1 \leq n \l ......
Elimination Technocup Eversion Array Round

Knights of the Round Table

prologue 相信很多人都感觉这个题不就是求一下这个二分图的最大独立集嘛,有什么难的,(劈里啪啦、库里跨啦、叮里哐啷)好,不对,好好好,题解! analysis 这个题目实际上并不是一个完整的最大独立集问题,因为在这个题里面,是可以有相互仇恨的骑士的,只要不让他们二人坐成同桌就行。 那么我们就不 ......
Knights Round Table the of

Codeforces Round 899 (Div. 2)

Codeforces Round 899 (Div. 2) A. Increasing Sequence 解题思路: 从左往右一个个看,从1开始,如果当前位相同\(+2\),否则\(+1\)。 代码: #include <bits/stdc++.h> using namespace std; usi ......
Codeforces Round 899 Div

2023-09-26 SAS 四舍五入 - PUT 与 ROUND

我在创建用于生成TFL的数据集时,通常会将数值型变量转换为字符型。因为 put 函数貌似能够对数值进行四舍五入,此前贪图方便,通常都是直接使用 put 函数直接转换,但在近期项目中,这种做法带来了一个让人摸不着头脑的问题。 这是一个两组别的随机对照试验,同事采取的方法是各组别分别使用 means 过 ......
ROUND 2023 SAS PUT 09

Java 8 Stream流处理字段类型String转Double

一、背景 二、实现 double componentTotalWeight = componentMapper.selectList(componentQuery).stream().map(i -> Double.parseDouble(i.getTotalWeightCustomer())).r ......
字段 类型 Double Stream String

Educational Codeforces Round 155 D (CF1879_D)

题目大意 给一个长度为 \(n\) 的数组,求 \(\Sigma_{i=1}^{n} \Sigma_{j=i}^{n} 区间异或和 \times (j-i+1)\) 其中 \(n\leq 3e5,~a[i]\leq 1e9\) 分析 首先注意到由 \(l\) 到 \(r\) 的区间异或和可以转化为 ......
Educational Codeforces Round 1879 155

Codeforces Round 898 (Div. 4)

A. Short Sort #include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int t; cin >> t; for( string s ; t ; t -- ......
Codeforces Round 898 Div

hive string, map, struct类型的建表和导入数据语句

本文转载于 https://blog.51cto.com/u_14405/6419362,https://blog.csdn.net/tototuzuoquan/article/details/115493697 和 https://blog.csdn.net/weixin_43597208/art ......
语句 类型 数据 string struct