目录A - White CellsB - Can you solve this?C - Energy Drink CollectorD - XOR World A - White Cells #include<bits/stdc++.h> using namespace std; const int N = 1e6 + 5; typedef long long LL; int main(){ int a,b,c,d; cin >> a >> b &
目录A - Five AntennasB - Five DishesC - Five TransportationsD - Cake 123 A - Five Antennas #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; typedef long long LL; int a[5]; int main() { for (int i = 0; i < 5; i++) cin >&
链接 题意: 给定一个数组,每次从数组中拿两个数A 、B出来,再放一个数C进去,且C = min(A , B) 或者 C = gcd(A , B),问剩下的最后一个数有多少种可能。 思路: 假设数组为 a[ ] 首先,如果对所有的数取min的话,那么留下来的一定是最小的那个。 其次,对于一个式子 C = GCD(A , B) , 那么一定满足:C
目录A - Already 2018B - Kagami MochiC - OtoshidamaD - Katana Thrower A - Already 2018 #include<bits/stdc++.h> using namespace std; const int N = 1e6 + 5; typedef long long LL; string s; int main(){ cin>>s; s[3] = '8'; cou
AtCoder Beginner Contest 191 第一次打Atcoder,迟到了,只做了AB A - Vanishing Pitch 题意:打棒球,棒球飞行速度是\(V\),棒球当且仅当在第\(T-S\)秒(含)中会隐形,当棒球飞出去\(d\)之后就要打球,如果隐形就打不中,问是否能打中。 简单模拟题,看飞出去\(d\)的时间是否在隐形时间段中即可。 #i
目录A - Traveling BudgetB - ChocolateC - Traveling PlanD - Grid Components A - Traveling Budget #include<bits/stdc++.h> using namespace std; const int N = 1e6 + 5; typedef long long LL; int a, b, c, d; int main(){ cin >> a >> b >&
目录A - Colorful TransceiversB - ExponentialC - K-th SubstringD - Equals A - Colorful Transceivers 给出abcd四个数,abc都是一维坐标,问a能否和c直接或间接联通,坐标差值在d以内的可以直接联通 直接模拟即可 #include<bits/stdc++.h> using namespace std; const int N = 1e6
A: Takahashi和Aoki分别有A和B颗糖果,两人轮流吃一个,若C为0则Takahashi先吃,C为1则Aoki先吃,先吃完的为输。 1 #include <iostream> 2 #include <cstdio> 3 #include <vector> 4 #include <algorithm> 5 #include <queue> 6 #include <vector> 7 #include <
Bowls and Dishes 题意: 给你n个dish。有m个条件。一个条件要成立,那么它要两个给定的dish中有球。现在又k个人。每个人可以选择一个dish然后放球,且每个人有两个选择。问:怎样可以使得 m个条件尽量成立。 思路: 数据小,可以考虑直接暴搜。 AC #include <iostream> #include <bits/
第一次参加 AtCoder 的比赛,感觉还挺简单。 比赛链接:https://atcoder.jp/contests/abc189 A - Slot // Author : RioTian // Time : 21/01/23 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 10; int main() { // freopen("in.txt&qu
A Large Digits int n; int main() { IOS; int a, b, resa = 0, resb = 0; cin >> a >> b; while(a) resa += a % 10, a /= 10; while(b) resb += b % 10, b /= 10; cout << max(resa, resb) << endl; return 0; } B Gentle Pairs int n; i
AtCoder Beginner Contest 188 F- +1-1x2 记忆化搜索 题意思路Code 传送门: https://atcoder.jp/contests/abc188/tasks/abc188_f 题意 在 只 能 在
题目描述 给你两个数 \(x\),\(y\) 可以对 \(x\) 进行 \(+1,-1\) 或 \(\times 2\) 的操作 问最少操作多少次后变为 \(y\) \(x,y \leq 10^{18}\) 分析 将问题转化为从 \(y\) 变为 \(x\),可以进行 \(+1,-1\) 或 \(\div 2\) 的操作 之所以这样做,是因为转化题意之后操作更受约束 如果当
Description 一个序列有 2 n 2n 2n个数,现在你要在这个序列中配得 n n n个无
你是我可爱的诱惑,温柔的牵绊,无法割舍的存在.你说青涩最搭初恋,我们有相遇的时间,在风暖月光的地点,海之角也不再遥远.你我之间,看不见的宣言,一直都在,重复过很多年. 题解如下图: #include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <cst
Problem 题目地址 Solution 前置知识(只是为了书写方便) \(m^{\underline{n}}=m(m-1)(m-2)...(m-n+1)=\frac{m!}{n!}\)(\(m^\underline{n}\) 这个东西叫下降幂)。 题解 首先对于限制1 和限制2,合法方案数为 \((m^\underline{n})^2\)(包括限制3 的不合法方案)。 考虑减去限制3 的不合法
C - Super Ryuma 每个点可以到的区域可以分为两种情况: 方式1.以起点为原点直线 y=x 和 直线 y=-x 上的点; 方式2.与起点曼哈顿距离小于等于3的点, 任意两点之间至多需要移动三次,过起点做斜率为1的直线,以重点做斜率为-1 的直线(交换一下也可以),一定有交点,如果交点坐标都为整数,则两
前两题就是憨批题,从第三道开始补题吧 第三题 一个简单的DFS。看错题意了以为是==8皇后,事实上就是个不断模拟进行搜索的过程,用个deep记录遍历深度即可。 #include <bits/stdc++.h> using namespace std; int N, K; int a[10][10]; //int b[10][10]; bool vis[10]; int ans; int nu
https://atcoder.jp/contests/abc182/tasks/abc182_f 题意: 有n种面值的货币a[i],满足a[i]是a[i-1]的倍数,a[1]=1 有一种价值为x的商品,付款y元,找零y-x元 问满足以下2个条件的y有多少种 条件1:付款和找零时,使用的货币数量在对应金额下最少 条件2:在满足条件1的前提下,付款所用的面值,找
题目颜色大致代表洛谷题目难度,点击各题标题可以跳转到原题。 A - Heavy Rotation 简化题意:给出正整数 $n$,如果 $n$ 是奇数输出 Black,否则输出 White,$n \le 30$。 题解:这题还要题解? 代码:https://atcoder.jp/contests/abc181/submissions/17780998 B - Trapezoid Sum 简化题意: 有
题目链接:https://atcoder.jp/contests/abc178/tasks/abc178_e 题意:给定n组坐标 求 思路: 去绝对值化简 假设xi>xj 有xi-xj+yi-yj 则(xi+yi)-(xj+yj) 或者有 xi-xj-yi+yj 则 (xi-yi)-(xj-yj) 所以把用两个数组记录x+y x-y 排序在找最大的差即可 1 #includ
题意 & 题解 A Don't be late 题意:给你路程,时间限制,速度,问你能不能在时间限制内走路程那么远。 题解:数学题?物理题? B Substring 题意:给你两个字符串 \(s,t\),问你最少更改 \(s\) 几次能使得 \(t\) 是 \(s\) 的字串。 题解:因为字符串长度小于 \(1000\) 直接暴力枚举 \(t\) 出现在 \(s
1 const fastify = require('fastify'); 2 const nunjucks = require('nunjucks'); 3 const crypto = require('crypto'); 4 5 6 const converters = {}; 7 8 const flagConverter = (input, callback) => { 9 const flag = &
E - Red Scarf Time Limit: 2 sec / Memory Limit: 1024 MB Score : 500500 points Problem Statement There are NN Snuke Cats numbered 1,2,…,N1,2,…,N, where NN is even. Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is wri
颓了三天端午回来打比赛,还是秒切前几道水题但做不动后面的难题,任重道远啊。 前四题思路都比较简单,C枚举一个数组的前缀和并用差值在另外一个数组里二分查找,D可以线性筛约数个数函数然后暴力算,也可以分析每个数的贡献来搞,复杂度都为O(n)。 E没有做出来是真的不爽,只想到了先考虑A,