摘要: AtCoder Regular Contest 138 A - Larger Score 搞个结构体,存储每个点的值和位置,从大到小排序,当值相等时位置小的在前面。利用pos和ans找到当前大于k且id最小的点,和小于k的点,不断更新最小值。 #include<iostream> #include< 阅读全文
posted @ 2022-04-10 16:57 menitrust 阅读(39) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #781 (Div. 2) A. GCD vs LCM 啊,太久没接触最小公倍数了脑子抽了相成了最大公倍数,导致搞了很久。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstrin 阅读全文
posted @ 2022-04-09 19:24 menitrust 阅读(6) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #739 (Div. 3) A. Dislike of Threes #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using na 阅读全文
posted @ 2022-04-08 11:04 menitrust 阅读(17) 评论(0) 推荐(0) 编辑
摘要: AtCoder Beginner Contest 246 A - Four Points 统计一下谁只出现过一次输出就行,看别人直接异或更简洁 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #inc 阅读全文
posted @ 2022-04-03 00:35 menitrust 阅读(18) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #780 (Div. 3) A. Vasya and Coins #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using name 阅读全文
posted @ 2022-04-01 09:59 menitrust 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #779 (Div. 2) A. Marin and Photoshoot 把所有0的位置找出来放到数组里,如果相邻的0距离为1的话,说明要往中间插2个1,如果距离为2的话只需要插1个1。 #include<iostream> #include<cstdio> #i 阅读全文
posted @ 2022-03-28 01:51 menitrust 阅读(46) 评论(0) 推荐(0) 编辑
摘要: AtCoder Beginner Contest 245 A - Good morning 感觉自己写的有点长了,还是题解来的简洁 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<c 阅读全文
posted @ 2022-03-27 21:56 menitrust 阅读(15) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #764 (Div. 3) A. Plus One on the Subset 从最小的变成最大的,也就是最大值和最小值之差。 #include<iostream> #include<cstdio> #include<algorithm> #include<cstr 阅读全文
posted @ 2022-03-23 23:27 menitrust 阅读(25) 评论(0) 推荐(0) 编辑
摘要: CFAB训练赛5 A - Assigning to Classes 从小到大排序,找到中位数以及和它的下一位,最小值就是他们之差。因为总是可以分成两组,那么我们只需要让这两个数分别是不同组的中位数就可以了,至于这两组怎么排序并不重要。 #include<iostream> #include<cstd 阅读全文
posted @ 2022-03-22 21:56 menitrust 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 蓝书 AcWing 193. 算乘方的牛 这里估计函数可以设计为当前的最大的数到目标数还需要乘多少次2。对于题目要求我们可以有8种操作方式,1.将a+b放在a的位置。2.将a+b放在b的位置再交换。3.a自乘。4.a自乘放在b的位置再交换。5.b自乘放在a的位置。6.b自乘再与a交换。7.a除b放在 阅读全文
posted @ 2022-03-21 14:44 menitrust 阅读(19) 评论(0) 推荐(0) 编辑