随笔分类 - noip刷题记录
摘要:题目描述 H 国有 n 个城市,这 n 个城市用 n-1 条双向道路相互连通构成一棵树,1 号城市是首都,也是树中的根节点。 H 国的首都爆发了一种危害性极高的传染病。当局为了控制疫情,不让疫情扩散到边境城市(叶子节点所表示的城市),决定动用军队在一些城市建立检查点,使得从首都到边境城市的每一条路径
阅读全文
摘要:背景 在双人对决的竞技性比赛,如乒乓球、羽毛球、国际象棋中,最常见的赛制是淘汰赛和循环赛。前者的特点是比赛场数少,每场都紧张刺激,但偶然性较高。后者的特点是较为公平,偶然性较低,但比赛过程往往十分冗长。 本题中介绍的瑞士轮赛制,因最早使用于 1895 年在瑞士举办的国际象棋比赛而得名。 它可以看作是
阅读全文
摘要:三国游戏 三国游戏 描述 小涵很喜欢电脑游戏,这些天他正在玩一个叫做《三国》的游戏。 在游戏中,小涵和计算机各执一方,组建各自的军队进行对战。游戏中共有N 位武将(N为偶数且不小于4),任意两个武将之间有一个“默契值”,表示若此两位武将作为一对组合作战时,该组合的威力有多大。游戏开始前,所有武将都是
阅读全文
摘要:比较难的题单独拉出来讲咯 华容道 描述 小 B 最近迷上了华容道,可是他总是要花很长的时间才能完成一次。于是,他想到用编程来完成华容道:给定一种局面,华容道是否根本就无法完成,如果能完成,最少需要多少时间。 小 B 玩的华容道与经典的华容道游戏略有不同,游戏规则是这样的: 在一个 n*m 棋盘上有
阅读全文
摘要:T1 质因数分解 题目传送门 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define LL long long using namespace std; LL read(){ LL ans=0,f=
阅读全文
摘要:T1 多项式输出 题目传送门 就是道模拟题咯 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int read(){ int ans=0,f=1,c=getchar(); while(c<'0'|
阅读全文
摘要:T1 转圈游戏 题目传送门 果不其然 第一题还是模拟题 一波快速幂解决问题 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int read(){ int ans=0,f=1,c=getchar(
阅读全文
摘要:T1 金币 题目传送门 就是道模拟题咯 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int read(){ int ans=0,f=1,c=getchar(); while(c<'0'||c>
阅读全文
摘要:T1 记数问题 题目传送门 这道题就是一道暴力咯 其实感觉数据大点一个应该是道数位dp了 不过还是懒所以写了暴力 #include<cstdio> #include<cstring> #include<algorithm> #define LL long long using namespace s
阅读全文
摘要:T1 生活大爆炸版 石头剪刀布 题目传送门 就是道模拟题咯 #include<algorithm> #include<cstdio> #include<cstring> using namespace std; int read(){ int ans=0,f=1,c=getchar(); while
阅读全文
摘要:珠心算测验 题目传送门 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int read(){ int ans=0,f=1,c=getchar(); while(c<'0'||c>'9'){if(
阅读全文
摘要:T1 神奇的幻方 题目传送门 就只是一道模拟题 水水水 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int read(){ int ans=0,f=1,c=getchar(); while(c
阅读全文
摘要:T1 玩具谜题 题目传送门 这道题直接模拟就好了哇 233 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int M=1e5+7; int read(){ int ans=0,f=1
阅读全文
摘要:T1 买铅笔 题目传送门 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int inf=0x3f3f3f3f; int read(){ int ans=0,f=1,c=getchar
阅读全文