题解codeforces round 1805

Educational Codeforces Round 152 (Rated for Div. 2)记录

A. Morning Sandwich #include <cstdio> #include <algorithm> #include <cmath> #include <vector> #include <string.h> #include <set> #include <string> #in ......
Educational Codeforces Round Rated 152

SMU Summer 2023 Contest Round 7

# [SMU Summer 2023 Contest Round 7](https://codeforces.com/group/L9GOcnr1dm/contest/464081) ## [A. Two Rival Students](https://codeforces.com/group/L9 ......
Contest Summer Round 2023 SMU

Educational Codeforces Round 76 (Rated for Div. 2)

Educational Codeforces Round 76 (Rated for Div. 2) A - Two Rival Students 思路:最多可加x个距离,且最后的距离不能超过n-1 #include<bits/stdc++.h> using namespace std; #defi ......
Educational Codeforces Round Rated Div

Educational Codeforces Round 152 A~D

A #include <bits/stdc++.h> #define endl '\n' #define ios ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) using namespace std; typedef ......
Educational Codeforces Round 152

【题解】HDOJ 7304 [2023杭电多校] Out Of Control

题目传送门:[HDOJ 7304 [2023杭电多校] Out Of Control](https://acm.hdu.edu.cn/showproblem.php?pid=7304) # 题意 给长度为 $n$ 的序列 $a_n$ 以及 $k$ ,问容量分别为 $i \in k$ 时,有多少种取 ......
题解 Control HDOJ 7304 2023

Codeforces Round 888 (Div. 3) 题解

考场上 $7$ 题做出来 $4$ 题,最后几分钟才把 D 题调出来,但还是吃了不少罚时 # A. Escalator Conversations $O(n)$ 枚举即可,对于每个人计算需要的间隔台阶数是否在 $(0,m)$ 以内以及相差高度是否是 $k$ 的倍数 # B. Parity Sort 显 ......
题解 Codeforces Round 888 Div

题解 Gym 103960K【Kalel, the Jumping Frog】

## problem 一只青蛙,他会跳,现在要从 $1$ 跳到 $n$。跳一次有 $m$ 种跳法,假设现在在 $x$,那么第 $i$ 次可以从 $x$ 跳到 $x+d_i$,同时消耗 $p_j$ 的能量。问你有多少种跳的方案使得消耗能量不超过 $k$。$n\leq 10^9,m\leq 10^5,1 ......
题解 103960K Jumping 103960 Kalel

Educational Codeforces Round 152 (Rated for Div. 2) C. Binary String Copying

# C. 二进制字符串复制 每次测试的时间限制2秒 每个测试的内存限制256兆字节 输入标准输入 输出标准输出 给你一个字符串s包含由...组成n个0或1。给出m次操作,让i-th 副本是字符串ti。然后,您对每个副本执行一次操作:i-th 副本,您对其子字符串进行排序[li,ri](子字符串来自原 ......
Educational Codeforces Copying Binary String

Educational Codeforces Round 76

# A. Two Rival Students 让两个人向两侧走就好了。 ```cpp #include using namespace std; void solve(){ int n , x , a , b; cin >> n >> x >> a >> b; if( a > b ) swap( ......
Educational Codeforces Round 76

CF1188B 题解

[题目传送门](https://www.luogu.com.cn/problem/CF1188B) 感觉并不是特别难的题。 首先是一个简单的推式子,有原式: $$(a_i+a_j) \times ({a_i}^2+{a_j}^2) \equiv k \mod p$$ 如何针对 $a_i+a_j$ 进 ......
题解 1188B 1188 CF

P2679 [NOIP2015 提高组] 子串 题解

[原题](http://https://www.luogu.com.cn/problem/P2679 "原题")\ $题目大意$\ $从字符串a中选出k个子串s_1,s_2,s_3...s_k使得s_1+s_2+s_3+...+s_k=b$\ $求总方案数对10^9+7取模的结果$\ $1\le | ......
题解 P2679 2679 2015 NOIP

AT_tenka1_2015_qualB_b 题解

[洛谷链接](https://www.luogu.com.cn/problem/AT_tenka1_2015_qualB_b)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/tenka1_2015_qualB_b) ......
题解 AT_tenka qualB_b tenka qualB

题解:【ICPC WF 2021 C】 Fair Division

[题目链接](https://www.luogu.com.cn/problem/P9441) 记 $g = 1 - f$,即传递下去的宝藏有多少。如果一个海盗在第一轮得到了 $x$,则第二轮将得到 $g^n x$,第 $T$ 轮得到 $g^{Tn} x$,于是在极限情况下总共得到的宝藏为 $\dfr ......
题解 Division ICPC 2021 Fair

CF709B 题解

[洛谷链接](https://www.luogu.com.cn/problem/CF709B)&[CF 链接](http://codeforces.com/problemset/problem/709/B) 本篇题解为此题**较简单做法**及**较少码量**,并且码风优良,请放心阅读。 ## 题目简 ......
题解 709B 709 CF

HDU1702 ACboy needs your help again! 题解

#include <iostream> #include <string> #include <queue> #include <stack> using namespace std; int t, n, m; int main() { cin >> t; while (t--) { queue<i ......
题解 ACboy needs again 1702

Educational Codeforces Round 1

# Educational Codeforces Round 1 ## A. Tricky Sum ```cpp int fac[N],p2[N]; void init(){ fac[0]=1;p2[0]=1; for(int i=1;i0?"YES":"NO"); //puts(ans>0?"Ye ......
Educational Codeforces Round

P1880 [NOI1995] 石子合并 题解

区间DP。 首先将其复制一遍(因为是环)。 设 $f[i][j]$ 表示将 $i$ 到 $j$ 段的石子合并需要的次数。 有 $$f[i][j] = 0(i = j)$$ $$f[i][j] = min(max)\{f[i][k] + f[k + 1][j] + \sum_{k = i }^{j}a ......
题解 石子 P1880 1880 1995

P1941 [NOIP2014 提高组] 飞扬的小鸟 题解

我们先不管障碍物。 设 $f[i][j]$ 表示来到点 $(i,j)$ 的最少点击屏幕数。 因为每秒要不上升 $k\times x[i]$,要么下降 $y[i]$。 所以有: $$f[i][j] = min(f[i - 1][j + y[i]], f[i - 1][j - k \times x[i] ......
题解 小鸟 P1941 1941 NOIP

HDU4841 AHOI1999 圆桌问题 题解

朴素的约瑟夫问题,用vector处理即可 #include <iostream> #include <vector> using namespace std; //AHOI1999 圆桌问题 类似于约瑟夫问题 vector<int>table; int n, m; int main() { whil ......
题解 圆桌 问题 4841 1999

【题解】[HNOI2015] 落忆枫音

[题目传送门](https://www.luogu.com.cn/problem/P3244) 感觉这题挺有意思的,遂写。 ## 题目大意 给出一个有向无环图,再给定两个点 $s$ 和 $t$,表示在点 $s$ 和 $t$ 间加上一条边。求这个图有多少种生成树。 ## 题目分析 首先考虑不加边之前的 ......
题解 HNOI 2015

P2127 序列排序 题解

[原题](http://https://www.luogu.com.cn/problem/P2127 "原题") # 题目意思 $有一个数列a,每次可以挑选任意两个元素交换位置,代价为这两个元素的和,问把序列a升序排序所需的最小总代价$\ $定义数列上的一个有i个元素的环S使得s_1要换到s_2,s ......
题解 序列 P2127 2127

CodeForces 1268E Happy Cactus

[洛谷传送门](https://www.luogu.com.cn/problem/CF1268E "洛谷传送门") [AtCoder 传送门](https://codeforces.com/problemset/problem/1268/E "AtCoder 传送门") 考虑一些简单的情况,比如树。 ......
CodeForces Cactus 1268E Happy 1268

【题解】Max to the Right of Min - Codeforces 1849E

**出处:** Educational Codeforces Round 152 **链接:** https://codeforces.com/problemset/problem/1849/E **题目大意:** TODO(先去看原题吧) **解题思路:** PS:这里的解题思路跟标准答案不太一样 ......
题解 Codeforces 1849E Right 1849

练习记录-cf-Educational Codeforces Round 152 (Rated for Div. 2)(A-D)

A. Morning Sandwich 题意:有面包片和火腿和芝士 问最多能组成几层三明治 题解:直接输出单考虑面包片和单考虑火腿和芝士的数量 取min #include<bits/stdc++.h> #define close std::ios::sync_with_stdio(false),ci ......

Codeforces Round 888 (Div. 3)记录

A. Escalator Conversations #include<cstdio> #include<algorithm> #include<cmath> #include<vector> #include<string.h> #include<set> #include<string> #in ......
Codeforces Round 888 Div

P3244 [HNOI2015] 落忆枫音 题解

https://www.luogu.com.cn/problem/P3244 题目简述 有一个$n$个点,$m$条边的DAG,现在向这个图中添加一条$l到r$的有向边,问有多少种以1为根的外向树方案。 数据范围 $1\le n\le 10^5,n-1 \le m \le min(2*10^5,\fr ......
题解 P3244 3244 2015 HNOI

P6190 [NOI Online] 题解

### [题目链接](https://www.luogu.com.cn/problem/P6190) ## description 给定一张简单带权有向图以及一个非负整数 $k$,从 1 号节点出发,最终到 $n$ 号节点,可重复经过点,且可以不超过 $k$ 次将当前经过的边的权值变为它的相反数计入 ......
题解 Online P6190 6190 NOI

AT_arc113_c 题解

[洛谷链接](https://www.luogu.com.cn/problem/AT_arc113_c)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/arc113_c) 本篇题解为此题**较简单做法**及**较少 ......
题解 AT_arc 113 arc AT

AT_abc182_d 题解

[洛谷链接](https://www.luogu.com.cn/problem/AT_abc182_d)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/abc182_d) 本篇题解为此题**较简单做法**及**较少 ......
题解 AT_abc 182 abc AT

重建 题解

[重建](https://www.luogu.com.cn/problem/P3317) ### 题目大意 给定一张无向图,第 $i$ 条边存在的概率为 $p_i$,求这个无向图是一颗树的概率。 ### 思路分析 所求即为: $$\sum_{T}\Bigg(\prod_{e\in T}p_e\Big ......
题解