round math

P9993 [Ynoi Easy Round 2024] TEST_133 题解

思路 看到时限这么大,考虑暴力做法。 我们将原序列分为 \(\text{B}\) 个块,每个块类似线段树三一样的维护 \(add,maxadd\),表示这一块需要加的值,加的值的历史最大值。 同时对于每个数可以维护一个真实值与一个历史最值。 那么下传标记可以写成这样。 inline void pus ......
题解 P9993 Round 9993 2024

P9994 [Ynoi Easy Round 2024] TEST_132 题解

题解怎么都是用暴力日过去的啊。 思路 考虑根号分治,设阈值为 \(B\)。 对于第二维出现次数超过 \(B\) 的,我们可以在修改时暴力更改,这部分复杂度为 \(O(\frac{nm}{B})\)。 对于第二维出现次数小于 \(B\) 的,我们可以在修改是打标记,查询时遍历一遍,这部分的复杂度为 \ ......
题解 P9994 Round 9994 2024

P9991 [Ynoi Easy Round 2023] TEST_107 题解

思路 题目即要求删除区间中的一个或多个颜色。 考虑假如枚举删除颜色 \(k\)。 那么在 \(l,r\) 中的答案为: \[\max_{i=1}^{m+1} a_i-a_{i-1} \]其中 \(a_i\) 为颜色 \(k\) 在 \(l\sim r\) 中的出现位置,\(a_{0}=l,a_{m+ ......
题解 P9991 Round 9991 2023

System&Math&包装类&文本扫描器&String总结

总结 System类 1、注意设计类的时候,不要将类名设计为和jdk提供的类名一样 掌握属性和方法 属性: err:获取标准的输出流(打印错误信息) out:标准的输出流,打印任意信息 in:获取标准的输入流,可以获取控制台输入的信息 方法:(全部是类方法) 1、currentTimeMillis( ......
amp 扫描器 文本 System String

数学专业math

数学与应用数学专业 数学分析、高等代数、解析几何、微分方程、实变函数、泛函分析、概率论、数理统计、复变函数、大学物理、抽象代数、初等数学研究、数学教育学。 数学分析、高等代数、解析几何、微分方程、概率统计、复变函数、西方经济学、多元统计分析、Python语言基础、大数据分析与挖掘、统计分析软件 信息 ......
数学 专业 math

Pinely Round 3 (Div. 1 + Div. 2)

A. Distinct Buttons #include<bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; int a=0,b=0,c=0,d=0; for(int i=1;i<=n;i++){ int x,y; cin ......
Div Pinely Round

题解 P9993【[Ynoi Easy Round 2024] TEST_133】

就硬把 线段树 3 和 数列分块入门 2 揉到一起出。 维护原数组 \(a\) 及其历史最大值 \(hist\),对每个块,维护块内 \(a\) 升序排序后结果 \(p\)、块内 \(a\) 升序排序后历史最大值前缀和 \(prehist\)、块加标记 \(add\)、块历史和加标记 \(hista ......
题解 P9993 Round 9993 2024

gym103415A Math Ball

套路生成函数。 写出答案的式子,设 \(f_i(x)=\sum j^{c_i} x^j\),不难得到答案为: \[[x^W]{1\over 1-x}\prod_{i=1}^n f_i(x) \]考虑求 \(f_i(x)\)。看到指数上有 \(c_i\),想到用斯特林数展开: \[f_i(x)=\su ......
103415A 103415 Math Ball gym

LibreOJ#535. 「LibreOJ Round #6」花火

LibreOJ#535. 「LibreOJ Round #6」花火 \(n\) 个烟火排成一排,从左到右高度分别为 \(h_1,h_2,\cdots,h_n\),这些高度两两不同。 每次 Yoko 可以选择两个相邻的烟火交换,这样的交换可以进行任意多次。 每次 Yoko 还可以选择两个不相邻的烟火交 ......
LibreOJ Round 535

Codeforces Round 915 (div2) E

E. Tree Queries [题目链接](https://codeforces.com/contest/1904/problem/EProblem - E - Codeforces) 题意概括: 给定一棵大小为 \(n\) 的树,回答如下询问,询问之间相互独立: 给定一个点 \(x\) 与 \( ......
Codeforces Round div2 915 div

Codeforces Round 917 (Div. 2)

基本情况 A题秒了,B题卡了一年。 B. Erase First or Second Letter Problem - B - Codeforces 卡题分析 两方面原因 没有变通,一开始的思路是公式算出总字串数再想办法找重复的减掉,但搞了一个小时都不可行,应该早点换成正着来找的思路。 没有更深入的 ......
Codeforces Round 917 Div

CF contest 1909 Pinely Round 3 (Div. 1 + Div. 2) 题解(Vanilla的掉分赛)

[Pinely Round 3 (Div. 1 + Div. 2) - Codeforces](https://codeforces.com/contest/1909) $$ \color{purple}\large\textbf{世界上只有一种真正的英雄主义,} $$ $$ \color{red}... ......
题解 Div contest Vanilla Pinely

Pinely Round 3 (Div. 1 + Div. 2)

A 构造题,分两种情况考虑 上下都行,左右选一个 左右都行,上下选一个 void solve() { int n; cin >> n; vector<pair<int, int> > a(n); for(auto &t : a) cin >> t.x >> t.y; sort(a.begin(), ......
Div Pinely Round

Pinely Round 3 (Div. 1 + Div. 2) A~D

A. Distinct Buttons // #include <bits/stdc++.h> #include <iostream> #include <string> #include <cstring> #include <vector> #include <algorithm> #inclu ......
Div Pinely Round

Pinely Round 3 (Div. 1 + Div. 2)

\(A.Distinct Buttons\) https://codeforces.com/contest/1909/submission/238508091 \(B.Make Almost Equal With Mod\) https://codeforces.com/contest/1909/s ......
Div Pinely Round

Math.random()生成任意范围的随机数

Math.random()随机数函数,返回一个0-1之间,并且包括0不包括1的随机小数[0,1) 1、生成0-10的随机数 Math.floor(Math.random()*(10+1)) 2、生成5-10的随机数 Math.floor(Math.random()*(5+1)+5) 3、生成n-m的 ......
随机数 范围 random Math

Codeforces Round 651 (Div. 2)C. Number Game(数学思维数论)

C. Number Game 我们考虑那些状态是必胜态 我的回合时n为奇数(除1外),直接除以n则必胜 下面偶数的情况稍复杂 偶数我们能进行的操作只有除以一个奇数,需要考虑怎么把当前状态变为对手的必败态 偶数一定含2的因子,\(n=2^k*q,q为奇数\) 当\(k=1时如果q\)是一个质数那么只能 ......
数论 Codeforces 思维 数学 Number

Codeforces Round 638 (Div. 2)B. Phoenix and Beauty

B. Phoenix and Beauty 这道题目学到的东西: 从给出的数据范围观察,得到一些有用信息(峰哥教的) 考虑无解的情况‘ 其实这题考虑怎么操作是比较难的,如果能想出来满足条件的结果就比较好了(我在说什么我自己也不知道,算了直接看下面的图吧) 假设\(k=3\),下面是我们得到的结果数列 ......
Codeforces Phoenix Beauty Round 638

Codeforces Round 916 (Div. 3)

目录写在前面ABCDE1/E2FG1G2写在最后 写在前面 比赛地址:https://codeforces.com/contest/1914。 第二天没早八打个 div3 休闲娱乐保持下手感,然而 div3 都 AK 不了了,纯纯废物一个,天天上大学导致的。 唉,一学期碰上好几个 byd 恼弹老师, ......
Codeforces Round 916 Div

Educational Codeforces Round 160 (Rated for Div. 2)

A. Rating Increase 字符串处理 #include<bits/stdc++.h> using namespace std; void solve(){ string s; cin>>s; int n=s.size(); s=" "+s; for(int i=1;i<=n-1;i++) ......
Educational Codeforces Round Rated 160

Codeforces Round 914 (Div. 2)A~D

A. Forked! 题意:有骑士,国王,王后,给出骑士的攻击方式,骑士的攻击方式类似象棋中的马,一个方向长度为1,一个方向长度为2,有8个位置,骑士的两方向攻击长度为a,b,当a,b不等的时候,有8个位置,相同则有4个位置,询问骑士能同时攻击到国王和王后的位置有几个(采用多组输入形式) 范围:给出 ......
Codeforces Round 914 Div

Codeforces Round 916 (Div. 3)

A. Problemsolving Log map枚举字母 #include<bits/stdc++.h> using namespace std; void solve(){ int n; string s; cin>>n>>s; int ans=0; s=" "+s; map<char,int> ......
Codeforces Round 916 Div

Codeforce Round 916(div3)

Codeforces Round 916(div3) [Problem - A - Codeforces]:Problemsolving Log A.题 直接看样例进行分析,发现每一次出现的字符代表着用了1分钟来看这道题,每道题都有固定的解题时间,只要达到了这个解题时间,就可以将这题解出来 , 答案 ......
Codeforce Round div3 916 div

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

A 统计一下每个字母的出现次数然后输出即可 #include <bits/stdc++.h> #define rep(i,a,b) for(register int i = (a); i <= (b); ++i) #define fep(i,a,b) for(register int i = (a) ......
Codeforces Round 916 Div E2

CF Round 916 (Div. 3)

link A 开个桶。 B 因为 \(k \leq n-1\),尝试让 \(a_2\) 到 \(a_{k+1}\) 有贡献,让 \(a\) 的前 \(k\) 项升序排列,剩余项降序排列即可。 C 假设只做前 \(x\) 个任务(\(x \leq k\)),那么答案 \(f_i\) 最大为 \(\su ......
Round 916 Div CF

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

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

math

use sage to calculate the a^p-1 mod p power_mod(a, p-1, p) eg: result = power_mod(5, 322, 323) print(result) result1 = power_mod(2, 2008, 2009) print( ......
math

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
共1424篇  :2/48页 首页上一页2下一页尾页