
AtCoder题解
文章平均质量分 88
努力的老周
一个老码农,中年大叔。打过工,做过老板。
现有神兽一枚,努力培养神兽中。
展开
-
ARC135 部分题解
竞赛地址https://atcoder.jp/contests/arc135/tasks。A - Floor, Ceil - Decompositionhttps://atcoder.jp/contests/arc135/tasks/arc135_a。题解数学题。给一个正整数 XXX,f(x)f(x)f(x) 是一通操作后乘积最大值。假设 X−=⌊x2⌋, X+=⌈x2⌉X_-=\lfloor \frac{x}{2} \rfloor,\ X_+=\lceil \frac{x}{2}原创 2022-02-14 14:03:27 · 527 阅读 · 0 评论 -
AtCoder ABC237题解
ABC237对应地址,https://atcoder.jp/contests/abc237/tasks。A - Not Overflow链接地址https://atcoder.jp/contests/abc237/tasks/abc237_a。题目要求给定一个整数XXX,判断 XXX 是否在 int\text{int}int 范围内。简易题解签到题。我们可以使用 C++ 的 INT_MAX 和 INT_MIN。如果不知道这两个常数,可以自己定义。AC代码#include<bit原创 2022-01-31 11:52:45 · 2652 阅读 · 6 评论 -
ABC216 题解
A 题链接https://atcoder.jp/contests/abc216/tasks/abc216_a。题解还是签到水题。本题的难度在于,如何将一个类似 X.Y\text{X.Y}X.Y 格式数据区分开。该类格式还有:X:Y\text{X:Y}X:Y 等。最简单的方法就是,将 X\text{X}X 和 Y\text{Y}Y 看成整数,中间的部分看成一个单字符。AC 代码#include <bits/stdc++.h>using namespace std;typedef原创 2021-08-30 10:57:16 · 419 阅读 · 0 评论 -
AtCoder ABC215简易题解
#链接https://atcoder.jp/contests/abc215/tasksA 题链接https://atcoder.jp/contests/abc215/tasks/abc215_a题解签到水题。给一个字符串,判断是否是 Hello,World!。AC代码#include <bits/stdc++.h> using namespace std; typedef long long LL;typedef pair<LL, LL> PLL; c原创 2021-08-21 22:34:21 · 648 阅读 · 0 评论 -
AtCoder ABC214 简单题解
好久没更新了。今天参加了一下 ABC,防止抑郁。A - New Generation ABC链接https://atcoder.jp/contests/abc214/tasks/abc214_a题解签到水题。给 ABC 竞赛的编号,问对应的竞赛有几个问题。AC 代码#include <bits/stdc++.h>using namespace std;typedef long long LL;typedef pair<LL, LL> PLL;const LL原创 2021-08-14 22:26:37 · 995 阅读 · 0 评论 -
AtCoder Beginner Contest 196 题解报告,AC了 A~E,缺 F
AtCoder Beginner Contest 196https://atcoder.jp/contests/abc196/tasks。A - Difference Maxhttps://atcoder.jp/contests/abc196/tasks/abc196_a。签到题,能看懂题目意思,应该就可以完成。给我们四个数字,找出一个 和,使得的结果最大。由于这四个数据是不相关的,要最大,那么要求最大同时最小即可。本题的数据非常小,用 int 即可。#i...原创 2021-03-21 11:57:11 · 1060 阅读 · 7 评论 -
AtCoder Beginner Contest 193 题解报告(先写 A ~ E,后面再写)
AtCoder Beginner Contest 193https://atcoder.jp/contests/abc193/tasks。A - Discounthttps://atcoder.jp/contests/abc193/tasks/abc193_a。老样子,A题还是签到题。题目要求计算折扣,要求答案的精度在以上。因此我们只需要输出的时候保留的小数点位数足够多就可以达到要求,比如保留 18 位。#include <iostream>#include <..原创 2021-02-28 10:40:12 · 804 阅读 · 1 评论 -
AtCoder Regular Contest 113 简单题解(AC了 A~C,缺 D~F)剩下的后面几天补一下
ARC 113https://atcoder.jp/contests/arc113/tasks。总体来说,自己还是一个菜鸡,还需要继续努力。退化太多了。A题:A*B*C题目链接https://atcoder.jp/contests/arc113/tasks/arc113_a。题解本题给了一个 K,求一个三元组 的个数,两个三元组只要数据位置不同也算不同。比如 (1,2,1) 和 (1,1,2) 就是不同的数据。一个标准数学题,数学的内容是调和级数(harmonic seri...原创 2021-02-21 23:45:32 · 933 阅读 · 1 评论 -
AtCoder Beginner Contest 192 简单题解(AC了 A~D,缺 E~F)
ABC192https://atcoder.jp/contests/abc192/tasks。A题:Star题目链接,https://atcoder.jp/contests/abc192/tasks/abc192_a。题解友善签到题。一个简单的数学题。获得 ans=X%100 余数,如果 ans 为零,则输出 100;否则输出 100-ans。AC 参考代码 #include <bits/stdc++.h> using namespace原创 2021-02-20 22:04:16 · 1633 阅读 · 3 评论 -
AtCoder Regular Contest 112 简单题解(AC 了 A ~ D,缺 E ~ F)
A 题:A - B = C题目链接https://atcoder.jp/contests/arc112/tasks/arc112_a。题解本题不难,如果数据量不大的话,本题可以使用暴力枚举的方法来解决。也就是在 [L, R] 之间枚举 A 和 B,并计算 C=A-B,这样算法的时间复杂度是的。我们看看本题的数据范围,本题给了 T 个样例,T 的最大值是 2e4。[L, R] 的最大值是 1e6。如果我们进行暴力枚举的话,计算量将达到,这样的计算量,我们肯定是没有办法在 1 秒内完成...原创 2021-02-13 23:47:10 · 1113 阅读 · 0 评论 -
AtCoder Beginner Contest 190 简易题解报告和 AC 代码(缺 D、E、F 题)
A - Very Very Primitive Game题目链接https://atcoder.jp/contests/abc190/tasks/abc190_a。简易题解还是一个签到题。我们根据输入 c 进行判断。如果 c==0,表示 Takahashi 先开始,那么Takahashi 必须必 Aoki 有跟多的糖果才能赢,即 a>b。同理,如果 c==1,表示 Aoki 先开始,那么Aoki 必须必 Takahashi 有跟多的糖果才能赢,即 b>a。AC 代码..原创 2021-01-31 11:11:00 · 415 阅读 · 2 评论 -
AtCoder ABC189 简单题解(目前完成到 D 题,缺 E 和 F)
由于开始忙起来,没有很多时间写详细题解。先简单写一个 ABC189 各题的思路。A - Slot题目链接,https://atcoder.jp/contests/abc189/tasks/abc189_a。签到题,不说也罢。字符读入,然后分析。B - Alcoholic题目链接,https://atcoder.jp/contests/abc189/tasks/abc189_b。根据题目意思,我们知道要对所有摄入的酒精进行累加求和。总酒精摄入计算公式如下:。如果 说明喝多了,原创 2021-01-25 15:45:27 · 781 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 188 —— F - +1-1x2 —— BFS剪枝
题目相关题目链接AtCoder Beginner Contest 188 F 题,https://atcoder.jp/contests/abc188/tasks/abc188_f。Problem StatementTakahashi has written an integer XXX on a blackboard. He can do the following three kinds of operations any number of times in any order:incre原创 2021-01-18 14:26:40 · 690 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 188 —— E - Peddler —— 动态规划
题目相关题目链接AtCoder Beginner Contest 188 E 题,https://atcoder.jp/contests/abc188/tasks/abc188_e。Problem StatementIn Takahashi Kingdom, there are NNN towns, called Town 111 through Town NNN.There are also MMM roads in the kingdom, called Road 111 through Ro原创 2021-01-17 16:23:40 · 553 阅读 · 0 评论 -
AtCoder题解 —— KEYENCE Programming Contest 2021 —— A - Two Sequences 2 —— 数论
题目相关题目链接KEYENCE Programming Contest 2021 A 题,https://atcoder.jp/contests/keyence2021/tasks/keyence2021_a。Problem StatementSnuke has two number sequences aaa and bbb, each of length NNN. The iii-th number of aaa is aia_iai, and that of bbb is bib_ibi.原创 2021-01-16 23:21:29 · 437 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 188 —— D - Snuke Prime —— 前缀和
题目相关题目链接AtCoder Beginner Contest 188 D 题,https://atcoder.jp/contests/abc188/tasks/abc188_d。Problem StatementSnuke Inc. offers various kinds of services.A payment plan called Snuke Prime is available.In this plan, by paying CCC yen (the currency of Ja原创 2021-01-14 14:20:40 · 497 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 188 —— C - ABC Tournament —— 数据结构之二叉树
题目相关题目链接AtCoder Beginner Contest 188 C 题,https://atcoder.jp/contests/abc188/tasks/abc188_c。Problem Statement2N2^N2N players, labeled 111 through 2N2^N2N, will compete against each other in a single-elimination programming tournament.The rating of Play原创 2021-01-12 17:58:39 · 714 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 188 —— B - Orthogonality —— 向量内积
题目相关题目链接AtCoder Beginner Contest 188 B 题,https://atcoder.jp/contests/abc188/tasks/abc188_b。Problem StatementGiven are two NNN-dimensional vectors A=(A1,A2,A3,…,AN)A=(A_1,A_2,A_3,…,A_N)A=(A1,A2,A3,…,AN) and B=(B1,B2,B3,…,BN)B=(B_1,B_2,B_3,…,B_N)B=(B原创 2021-01-12 16:02:30 · 280 阅读 · 3 评论 -
AtCoder题解 —— AtCoder Beginner Contest 188 —— A - Three-Point Shot
题目相关题目链接AtCoder Beginner Contest 188 A 题,https://atcoder.jp/contests/abc188/tasks/abc188_a。Problem StatementA basketball game is being played, and the score is now X-Y. Here, it is guaranteed that X≠YX≠YX=Y.Can the team which is behind turn the tabl原创 2021-01-12 15:43:57 · 575 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Regular Contest 111 —— A - Simple Math 2 —— 数论:快速幂
题目相关题目链接AtCoder Regular Contest 111 A 题,https://atcoder.jp/contests/arc111/tasks/arc111_a。Problem StatementGiven positive integers NNN and MMM, find the remainder when ⌊10NM⌋\left \lfloor \frac{10^N}{M}\right \rfloor⌊M10N⌋ is divided by MMM.InputIn原创 2021-01-10 15:09:19 · 659 阅读 · 1 评论 -
AtCoder题解 —— AtCoder Beginner Contest 187 —— D - Choose Me —— 贪心
题目相关题目链接AtCoder Beginner Contest 187 D 题,https://atcoder.jp/contests/abc187/tasks/abc187_d。Problem StatementAtCoder City will hold a mayoral election. The candidates are Aoki and Takahashi.The city consists of NNN towns, the iii-th of which has AiA_iA原创 2021-01-03 21:48:03 · 634 阅读 · 1 评论 -
AtCoder题解 —— AtCoder Beginner Contest 187 —— A - Large Digits
题目相关题目链接AtCoder Beginner Contest 187 A 题,https://atcoder.jp/contests/abc187/tasks/abc187_a。Problem StatementFor an integer nnn, let S(n)S(n)S(n) be the sum of digits in the decimal notation of nnn. For example, we have S(123)=1+2+3=6S(123)=1+2+3=6S(123原创 2021-01-03 13:46:59 · 393 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 187 —— B - Gentle Pairs —— 暴力
题目相关题目链接AtCoder Beginner Contest 187 B 题,https://atcoder.jp/contests/abc187/tasks/abc187_b。Problem StatementOn the xyxyxy-plane, We have NNN points numbered 111 to NNN. Point iii is at (xi,yi)(x_i,y_i)(xi,yi), and the xxx-coordinates of the NNN point原创 2021-01-03 13:32:12 · 503 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 187 —— C - 1-SAT —— 数据结构之哈希表
题目相关题目链接AtCoder Beginner Contest 187 C 题,https://atcoder.jp/contests/abc187/tasks/abc187_c。Problem StatementGiven are NNN strings S1,S2,…,SNS_1,S_2,…,S_NS1,S2,…,SN. Each of these is a non-empty string consisting of lowercase English letters, with ze原创 2021-01-02 22:26:46 · 639 阅读 · 1 评论 -
AtCoder题解 —— AtCoder Grand Contest 050 —— B - Three Coins —— 动态规划
题目相关题目链接AtCoder Grand Contest 050 B 题,https://atcoder.jp/contests/agc050/tasks/agc050_b。Problem StatementNNN cells are arranged in a row. The cells are numbered 111 through NNN from left to right.Initially, all cells are empty. You can perform the fol原创 2020-12-29 15:54:08 · 630 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Grand Contest 050 —— A - AtCoder Jumper —— 二叉树
题目相关题目链接AtCoder Grand Contest 050 A 题,https://atcoder.jp/contests/agc050/tasks/agc050_a。Problem StatementHave you noticed this part of AtCoder website?Here the numbers are carefully chosen so that we can jump from any page to any page in small number原创 2020-12-28 15:40:57 · 482 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 186 —— E - Throne —— 欧几里得求逆元
题目相关题目链接AtCoder Regular Contest 186 E 题,https://atcoder.jp/contests/abc186/tasks/abc186_e。Problem StatementWe have N chairs arranged in a circle, one of which is a throne.Takahashi is initially sitting on the chair that is S chairs away from the thron原创 2020-12-24 20:58:32 · 473 阅读 · 1 评论 -
AtCoder题解 —— AtCoder Beginner Contest 186 —— A - Brick
题目相关题目链接AtCoder Regular Contest 186 A 题,https://atcoder.jp/contests/abc186/tasks/abc186_a。Problem StatementWe have a truck, which can carry at most N kilograms.We will load bricks onto this truck, each of which weighs W kilograms. At most how many bri原创 2020-12-20 00:01:06 · 598 阅读 · 2 评论 -
AtCoder题解 —— AtCoder Beginner Contest 186 —— B - Blocks on Grid
题目相关题目链接AtCoder Regular Contest 186 B 题,https://atcoder.jp/contests/abc186/tasks/abc186_b。Problem StatementWe have a grid with H horizontal rows and W vertical columns. The square at the i-th row from the top and j-th column from the left has Ai,jA_{i,原创 2020-12-19 23:51:18 · 706 阅读 · 2 评论 -
AtCoder题解 —— AtCoder Beginner Contest 186 —— D - Sum of difference —— 前缀和
题目相关题目链接AtCoder Regular Contest 186 题,https://atcoder.jp/contests/abc186/tasks/abc186_d。Problem StatementGiven are N integers A1,⋯ ,ANA_1, \cdots, A_{N}A1,⋯,AN. Find the sum of ∣Ai−Aj∣\lvert A_{i}-A_{j} \rvert∣Ai−Aj∣ over all pairs i,ji,ji,j such原创 2020-12-19 23:32:14 · 566 阅读 · 3 评论 -
AtCoder题解 —— AtCoder Beginner Contest 186 —— C - Unlucky 7 —— 模拟算法
题目相关题目链接AtCoder Regular Contest 186 C 题,https://atcoder.jp/contests/abc186/tasks/abc186_c。Problem StatementTakahashi hates the number 7.We are interested in integers without the digit 7 in both decimal and octal. How many such integers are there betwe原创 2020-12-19 22:45:36 · 651 阅读 · 1 评论 -
AtCoder题解 —— AtCoder Beginner Contest 185 —— D - Stamp —— 模拟
题目相关题目链接AtCoder Regular Contest 185 D 题,https://atcoder.jp/contests/abc185/tasks/abc185_d。Problem StatementThere are N squares arranged in a row from left to right. Let Square i be the i-th square from the left.M of those squares, Square A1, A2, A原创 2020-12-16 16:49:39 · 725 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 185 —— C - Duodecim Ferra —— 组合数学、背包
题目相关题目链接AtCoder Regular Contest 185 B 题,Problem StatementThere is an iron bar of length L lying east-west. We will cut this bar at 11 positions to divide it into 12 bars. Here, each of the 12 resulting bars must have a positive integer length.Find原创 2020-12-14 14:27:44 · 867 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 185 —— B - Smartphone Addiction —— 模拟算法
题目相关题目链接AtCoder Regular Contest 185 B 题,https://atcoder.jp/contests/abc185/tasks/abc185_b。Problem StatementThe battery of Takahashi's smartphone has N mAh capacity. At time 0.5, 1.5, 2.5, and so on (that is, at time n+0.5 for every integer n), the原创 2020-12-13 23:15:33 · 645 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 185 —— A - ABC Preparation
题目相关题目链接AtCoder Regular Contest 185 A题,https://atcoder.jp/contests/abc185/tasks/abc185_a。Problem StatementTakahashi has decided to hold some number of programming contests.Holding one contest requires one 100-point problem, one 200-point problem,.原创 2020-12-13 22:46:33 · 529 阅读 · 1 评论 -
AtCoder题解 —— AtCoder Regular Contest 110 —— A - Redundant Redundancy
题目相关题目链接AtCoder Regular Contest 110 A题,https://atcoder.jp/contests/arc110/tasks/arc110_a。Problem StatementWe have an integer N.Print an integer x between N and (inclusive) such that, for every integer y between 2 and N (inclusive), the remainde.原创 2020-12-06 13:09:34 · 1316 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 184 —— E - Third Avenue - BFS
题目相关题目链接AtCoder Beginner Contest 184 E 题,https://atcoder.jp/contests/abc184/tasks/abc184_e。Problem StatementThere is a town represented as a two-dimensional grid with H horizontal rows and W vertical columns.A character ai,j describes the square a原创 2020-12-03 15:57:53 · 640 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Regular Contest 109 —— B - log —— 二分
题目相关题目链接AtCoder Regular Contest 109 B 题,https://atcoder.jp/contests/arc109/tasks/arc109_b。Problem StatementSnuke is visiting a shop in Tokyo called 109 to buy some logs. He wants n logs: one of length 1, one of length 2, ..., and one of length n. T原创 2020-12-01 09:56:15 · 679 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Regular Contest 109 —— A - Hands
题目相关题目链接AtCoder Regular Contest 109A题,https://atcoder.jp/contests/arc109/tasks/arc109_a。Problem StatementThere are two100-story buildings, calledAandB. (In this problem, the ground floor is called the first floor.)For eachi=1,…,100 thei-t...原创 2020-11-29 17:11:24 · 568 阅读 · 0 评论 -
AtCoder题解 —— AtCoder Beginner Contest 184 —— D - increment of coins,分别使用 DP 期望和蒙特卡洛方法模拟
题目相关题目链接AtCoder Beginner Contest 184 D 题,https://atcoder.jp/contests/abc184/tasks/abc184_d。Problem StatementWe have a bag containing A gold coins, B silver coins, and C bronze coins.Until the bag contains 100 coins of the same color, we will repe原创 2020-11-26 22:05:58 · 723 阅读 · 0 评论