[题解]SFMOI Round I A~C】的更多相关文章

CF Round #524 Div.2 - 竞赛题解 不容易CF有一场下午的比赛,开心的和一个神犇一起报了名 被虐爆--前两题水过去,第三题卡了好久,第四题毫无头绪QwQ Codeforces 传送门 Tab, 先写了ABC题,后面的之后再补 QwQ 『解析』 A-Petya and Origami 读懂题意就会做--根据题意可以求出3种"sheet"各自需要的数量,然后每一种的数量除以k向上取整后求和就是答案. B-Margarite and the best present 简单的…
Codeforces Round #549 (Div. 2) B. Nirvana [题目描述] B. Nirvana time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kurt reaches nirvana when he finds the product of all the digits of some positive int…
Problem CSA Round 18 题意概要:给定一个有重边有自环 \(n\) 点 \(m\) 边的有向无环图(DAG),每条边有其权值,每当你走到一个点 \(x\) 时,所有从 \(x\) 连出去的边上的权值会互相随机打乱,问从 \(S\) 到 \(T\) 最短路长度的期望 \(n,m\leq 10^3\) Solution 首先第一步很明显是按照 DAG 的拓扑序一个个地转移,只需考虑处理每个点怎么转移,设 \(f[x]\) 表示从 \(x\) 走到 \(T\) 的最短路长度期望 先暂…
[题目] A. Basic Diplomacy [描述] Aleksey有n个朋友,有一个m天的假期,每天都需要一个朋友来陪他.给出每天有空的朋友的编号,要求同一个朋友来的天数不能超过m/2上取整.求是否有一个朋友到访的方案,没有输出"NO",有输出"YES"并输出任意一种方案. 数据范围:1<=n,m<=100000,保证每天至少有一个朋友有空,共t组数据,1<=t<=10000 [思路] 这道题只要注意到"同一个朋友来的天数不能…
贪心的选取最优解 然后相减好 记得要开long long #include <cstdio> #include <algorithm> #include <cstring> #include <set> #include <queue> #define int long long using namespace std; ,ansb=,posa=,posb=,n,a[],b[]; bool cmp(int a,int b){ if(a>b)…
按照题意构造集合即可 注意无解情况的判断 #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <map> using namespace std; int n,sum; int main(){ scanf("%d",&n); ){ printf("…
依照题意暴力模拟即可A掉 #include <cstdio> #include <algorithm> #include <cstring> #include <set> using namespace std; ]; ]; int main(){ scanf("%d %d",&n,&k); scanf(); ;i<=n;i++) barrel[s[i]-]++; int ans=0x3f3f3f3f; ;i<…
T2还是模拟 枚举一下第一个放哪里 然后贪心的反转即可 虽然我也不会证,但是这题肯定有解qwq #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ],midpath[],midans; int main(){ scanf("%d %d",&n,&k); ;i<=k+;i++){ int l=i,r=k+i; midans=…
暴力模拟即可 就是情况略多 #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ],pos,ans=; int main(){ scanf("%d %d %d",&n,&a,&b); ;i<=n;i++) scanf("%d",&num[i]); ==){ pos=n/+; ) ans+=…
[题目] D. Mysterious Crime [描述] 有m个n排列,求一共有多少个公共子段. 数据范围:1<=n<=100000,1<=m<=10 [思路] 对于第一个排列来说,如果第k个位置开始往后L长的子段是一个公共的子段,那么从k开始往后数1,2,...,L-1长的子段都是公共的子段:如果第k个位置开始往后L长的子段是一个公共的子段,但第k个位置开始往后L+1长的子段不是一个公共的子段,那么位置k到位置k+L中任一位置j开始往后直到位置k+L的子段都不是公共的子段.这就…