目录
A - You should output ARC, though this is ABC.
B - Light It Up
C - ±1 Operation 1
D - ±1 Operation 2
E - Lucky Numbers
F - Pre-order and In-order
A - You should output ARC, though this is ABC.
A - You should output ARC, though this is ABC.https://atcoder.jp/contests/abc255/tasks/abc255_a
水题,输入r,c,和一个2*2的矩阵a,输出a[r][c]即可
#include
B - Light It Up
B - Light It UpAtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online.https://atcoder.jp/contests/abc255/tasks/abc255_b告诉你有n个点,其中k个可以发光,问让每个不发光的点被照射到,问最小需要多大的光照强度(即以发光点为圆心,发光强度为半径画圆,不发光的点在圆上或者圆内)
思路:看见数据很小,1000,直接把不发光的点和每个发光的点进行匹配,取这个点被光笼罩的最小值,在对于每个不发光点的最小值取最大值即可,时间复杂度是n方.
#include
C - ±1 Operation 1
C - ±1 Operation 1https://atcoder.jp/contests/abc255/tasks/abc255_c给你一个数x,一个等差数列的首项,公差和项数,问x需要几步变成这个数列的一员(只可以++或者- -);
思路:分情况讨论贪心.
因为这个等差数列可能是递增也有可能是递减,所以我们统一把它替换成递增等差数列计算.
分三个情况,当x<=首项时,直接计算首项和x的差即可,当x>=末项,直接计算末项和x的差即可.当x在等差数列范围之内,那么我们直接看x减去首项之后最近的能被公差整除的距离即可.
#include