题解p9580 round game

第二次比赛部分题解

P7060 [NWRRC2014] Alarm Clock #include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int arr[10]={6,2,5,5,4,5,6,3,7,6}; bool check= ......
题解 部分

AtCoder Beginner Contest 311 A-E题解

# A - First ABC ## 题意 给一个长度为N的仅由ABC三个字符组成的字符串S,问S中ABC三个字符第一次出现的位置的最大值。 ## 题解 使用`map`判重,记录当前不同的字符串的个数`cnt`,当`cnt`等于3时,输出此时的下标+1作为答案。 ## Code ```cpp #in ......
题解 Beginner AtCoder Contest 311

2023“钉耙编程”中国大学生算法设计超级联赛(2)部分题解

### 2023“钉耙编程”中国大学生算法设计超级联赛(2)部分题解 #### 7.20 ##### 1002 Binary Number 可以发现,每个位置最多修改两次,再多了没有意义。 当k为0时,无法修改直接输出。 当n为1时,看k的奇偶性,若为奇数则将其翻转输出,否则直接输出。 当n不为1时 ......
钉耙 题解 算法 联赛 部分

chinese game

# 0.0.0版本震撼来袭 代码: ```cpp #include #include #include using namespace std; int px=10,py=5,ma=0; string jie[100005]={"这是墙壁,你不能通过","这是地面,上面似乎布满了灰尘"}; stri ......
chinese game

P9473 [yLOI2022] 西施江南 题解

# Description 给定一个长为 $n$ 的序列 $\{a_n\}$,判断他们的最大公约数与最小公倍数的乘积是否等于序列中所有数的乘积。 对于所有数据,$1\leq n\leq5\times10^5$,$1\leq a_i\leq10^8$。 # Solution 设 $\displayst ......
题解 P9473 9473 2022 yLOI

洛谷 P9474 [yLOI2022] 长安幻世绘 题解

给定序列,选取一个恰好为给定长度的元素在原序列中不相邻的子序列,使得该子序列极差最小。排序后双指针,用 set 维护区间解决。 ......
题解 P9474 9474 2022 yLOI

P1833 樱花 题解

# 二进制拆分 做法:把每一个物品根据2的多少次方拆分,因为任何数都可以转化为二进制数 核心思想:把每一个物品拆成很多个,分别计算价值和所需时间,再转化为01背包求解 最后一点:完全背包可以把他的空间记为999999,不要太大,一般百万就足够了 还有一点:cin和scanf**不可以混用** # 代 ......
题解 P1833 1833

P1757 通天之分组背包 题解

## 思路 分组背包模版题,不多说。 # 代码 ```cpp #include #define ll long long #define ld long double using namespace std; inline void read(int &x) { x=0; short flag=1; ......
题解 背包 P1757 1757

P1679 神奇的四次方数 题解

## 思路 先枚举出 $n$以内的4次方数 然后dp. # 代码 ```cpp #include #define ll long long #define ld long double #define min(x,y) (x'9') { if(c=='-')flag=-1; c=getchar(); ......
题解 P1679 1679

P1616 疯狂的采药 题解

## 思路 这道题和 [NOIP2005 普及组] 采药的思路差不多 不同的是,这道题是完全背包,采药则是01背包。 转移方程为:```dp[j]=max(dp[j],dp[j-w[i]]+v[i]);//滚动数组优化``` # 代码 ```cpp #include #define ll long ......
题解 P1616 1616

第二次比赛出题题解

# 第二次比赛题解 ## [P1138 第 k 小整数 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)](https://www.luogu.com.cn/problem/P1138?contestId=120025) **主要了解set的用法,set会自动去重和排序** ```c ......
题解

Codeforces Round 886 (Div. 4)(A-H)

# A-To My Critics 读入 a,b,c 如果三个里较大的两个的和大于等于 10 输出 YES,不然输出 NO ``` #include using namespace std; void solve() { int a, b, c; cin >> a >> b >> c; cout = ......
Codeforces Round 886 A-H Div

Codeforces Round 886 (Div. 4)补题

# [Codeforces Round 886 (Div. 4)](https://codeforces.com/contest/1850) ## A~D: ```c++ //A: bool solve(){ cin>>a[1]>>a[2]>>a[3]; sort(a+1,a+4); return ......
Codeforces Round 886 Div

P1048 [NOIP2005 普及组] 采药 题解

## 思路 01背包模版题 转移方程为:```dp[j]=max(dp[j],dp[j-ti]+wi);//滚动数组优化``` # 代码 ```cpp #include #define ll long long #define ld long double using namespace std; ......
题解 P1048 1048 NOIP 2005

[ABC310G] Takahashi And Pass-The-Ball Game

Problem StatementThere are $N$ Takahashi. The $i$-th Takahashi has an integer $A_i$ and $B_i$ balls. An integer $x$ between $1$ and $K$, inclusive, wi ......
Pass-The-Ball Takahashi 310G Pass Ball

P1060 [NOIP2006 普及组] 开心的金明 题解

## 思路 ### 01背包模版题,唯一不同的是加了一个条件就是价格与重要度的乘积。 转移方程为:```dp[j]=max(dp[j],dp[j-w[i]]+w[i]*v[i]);``` 这里加了滚动数组优化。 ## 代码 ```cpp #include #define ll long long # ......
题解 P1060 1060 NOIP 2006

【大联盟】20230626 集查并(dsu) 题解 AT_toyota2023spring_final_g 【Git Gud】

【大联盟】20230626 集查并(dsu) 题解 AT_toyota2023spring_final_g 【Git Gud】 zyx /bx ## 题目描述 [here](https://atcoder.jp/contests/toyota2023spring-final/tasks/toyota ......

JOI2013 JOIOI の塔 (Tower of JOIOI)题解

# Description 给定一个由 `J`、`O`、`I` 组成的字符串,求最多能拆分成多少 `JOI` 或 `IOI`。 对于所有数据,$1\leq \vert S\vert\leq 10^6$。 # Solution 先处理出 $\text{pre}_i$ 为前缀 `J` 和 `I` 的数量 ......
题解 JOIOI Tower 2013 JOI

Codeforces Round 886 (Div. 4)

## F. We Were Both Children >![image-20230722103513062](https://zeoy-typora.oss-cn-hangzhou.aliyuncs.com/image-20230722103513062.png) ### 题解:约数 >* 我们先 ......
Codeforces Round 886 Div

Codeforces Round 886 (Div. 4)

Codeforces Round 886 (Div. 4) A - To My Critics 思路:最大的两个数的和大于等于10则YES #include<bits/stdc++.h> using namespace std; #define int long long typedef pair< ......
Codeforces Round 886 Div

【大联盟】20230703 T2 开心的序列(sequence) 题解 AT_agc049_f 【[AGC049F] Happy Sequence】

恐怖 zak 将这题加强,出到模拟赛。直接把 $A_i,B_i\le 10^5, C_i\le 5$ 变成了 $A_i,B_i,C_i\le 10^9$。 非常恐怖。 ## 题目描述 [here](https://www.luogu.com.cn/remoteJudgeRedirect/atcode ......
题解 大联盟 序列 049 20230703

「解题报告」Codeforces Round 886 (Div. 4)

比赛地址:[Dashboard - Codeforces Round 886 (Div. 4) - Codeforces](https://codeforces.com/contest/1850) 由于时间太晚了,因此并没有参加比赛,题目都是后来补做的。 ## A. To My Critics [P ......
Codeforces 报告 Round 886 Div

Codeforces Round 886 (Div. 4)

# A. To My Critics ```cpp #include using namespace std; #define int long long void solve(){ vector a(3); for( auto & i : a ) cin >> i; sort( a.begin() ......
Codeforces Round 886 Div

2023.07.21 SMU Summer 2023 Contest Round 5

# 2023.07.21 [SMU Summer 2023 Contest Round 5](https://codeforces.com/group/L9GOcnr1dm/contest/459203) ## A. Points in Segments ~~~ 给n个,1~m的子集,求1~n中所有 ......
2023 Contest Summer Round SMU

【周考】Round8 2024.7.21

# T1 [方差](http://222.180.160.110:1024/contest/3917/problem/1) 观察式子:$\large\sum\limits_{i=1}^{N-1} \sum\limits_{j=i+1}^{N}\left|A_{i}-A_{j}\right|^{2}= ......
Round8 Round 2024 21

Luogu P4552 [Poetize6] IncDec Sequence 更好的题解

[原题链接](https://www.luogu.com.cn/problem/P4552 "原题链接") 第一步对于学过差分的人应该不难想 定义差分数组 $dis \quad s.t. \quad dis[i] = a[i] - a[i-1] $ 那么不难发现问题一只要让 $dis[2] ... ......
题解 Poetize6 Sequence Poetize IncDec

2023 暑假集训模拟赛题解

[TOC] ## CSP 模拟 1 [来自学长的馈赠 2](https://www.cnblogs.com/CDOI-24374/p/16503427.html) . ## CSP 模拟 2 ### F 考虑 $x$ 只能在 $a_1\oplus b_i$ 里选,那么分别代入暴力检验即可 . 时间复 ......
模拟赛 题解 2023

幽灵乐团 题解

[幽灵乐团](https://www.luogu.com.cn/problem/P5518) ### 题目大意 $T$ 组数据,每组数据给定 $A,B,C$,求: $$\prod_{i=1}^A\prod_{j=1}^B\prod_{k=1}^C\Big(\frac{\text{lcm}(i,j)} ......
题解 幽灵 乐团

P9352 题解

[problem](https://www.luogu.com.cn/problem/P9352) & [blog](https://www.cnblogs.com/liangbowen/p/17571984.html)。 HerryHuang 的 DP 专题中最喜欢的一题,抢第一篇题解 /fend ......
题解 P9352 9352

SMU Summer 2023 Contest Round 5

# [SMU Summer 2023 Contest Round 5](https://codeforces.com/group/L9GOcnr1dm/contest/459203) ## [A. Points in Segments](https://codeforces.com/group/L9 ......
Contest Summer Round 2023 SMU