【AtCoder Beginner Contest 181】A~F题解】的更多相关文章

AtCoder Beginner Contest 238 \(A - F\) 题解 A - Exponential or Quadratic 题意 判断 \(2^n > n^2\)是否成立? Solution 当 \(n\) 为 2,3,4 的时候不成立,否则成立 Code #include <bits/stdc++.h> using namespace std; using LL = long long; int main() { int n; cin >> n; bool…
越学越菜系列 于2020.11.2,我绿了(错乱) A - Heavy Rotation 签到题,奇数Black,偶数White. code: #include<bits/stdc++.h> #define N 10000005 #define LL long long using namespace std; int t; int a,b; inline LL qr() { LL x=0,w=1;char a=0; while(a<'0'||a>'9'){if(a=='-')w=…
总结 第一次 \(AK\ ABC\) 的比赛,发一个截图纪念一下 A - Heavy Rotation 题目大意 一个人一开始穿白衣服,一天后换成黑衣服,再过一天又换成白衣服,问第 \(n(n \leq 30)\) 天这个人穿什么颜色的衣服 分析 当 \(n\) 为奇数时输出 \(Black\),否则输出 \(White\) 代码 #include<cstdio> #include<cstring> #include<algorithm> #include<cma…
目录 A - Seismic magnitude scales B - typo C - Select Mul D - Online games E - LEQ 发挥比较好的一场,就来搓篇题解. F 没时间写了,最后只是口胡了一下(还不是很对,改完后放上). A - Seismic magnitude scales 给你 \(A,B\),输出 \(32^{A-B}\) int Pow(int x, int p) { int res = 1; while(p) { if(p & 1) res =…
题意:有一长度为奇数\(n\)的数组\(a\),和长度为\(m\)的数组\(b\),现要求从\(b\)中选择一个数放到\(a\)中,并将\(a\)分成\((n+1)/2\)个数对,求最小的所有数对差的和. 题解:我们从\(b\)中选一个数出来,只和\(a\)中的一个元素配对,剩下的依然是\(a\)中\(n-1\)个数两两配对,所以我们可以先求个前缀/后缀和,然后枚举\(b\)在\(a\)中二分查找和\(b_i\)最近的数,但是会有个小问题,加入我们二分查找的位置是偶数,此时并不能完全配对,但是没…
Score: 600 points Approach 固定横坐标 $x$,考虑横坐标为 $x$ 的竖直线上最多可以有几个点. Observations 若最初两条竖直线 $x_1$.$x_2$ 上都有一个纵坐标是 $y$ 的点,则 这两条竖直线上的点可以"合并" 最终这两条竖直线上的点必定是一样的 我们发现了竖直线之间的等价关系:两条竖直线上有纵坐标相同的点. 用并查集维护这个等价关系.将同一个等价类中的竖直线上的点合并.…
AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) \[x=i,g(x)=0\] \[x\ne i ,g(x)=1\] 则我们可以构造 \[f(x)=\sum^{i=0}_{P-1}(-a_i*(x-i)^{P-1}+a_i)\] 对于第\(i\)条式子当且仅当\(a_i=1 \ and \ x=i\)时取到\(1\) 代码写的比较奇怪 const…
人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one…
目录 AtCoder Beginner Contest 153 题解 A - Serval vs Monster 题意 做法 程序 B - Common Raccoon vs Monster 题意 做法 程序 C - Fennec vs Monster 做法 程序 D - Caracal vs Monster 做法 程序 E - Crested Ibis vs Monster 做法 程序 F - Silver Fox vs Monster 做法 程序 感谢 AtCoder Beginner Co…
AtCoder Beginner Contest 177 题解 目录 AtCoder Beginner Contest 177 题解 A - Don't be late B - Substring C - Sum of product of pairs D - Friends E - Coprime F - I hate Shortest Path Problem A - Don't be late 问你能不能在时间\(T\)内用不高于\(S\)的速度走过\(D\)的路程,转化为判断\(ST\)…