![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Codeforces
文章平均质量分 76
Codeforces专栏
Tryna1
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #696 (Div. 2) (A ~ D)
Codeforces Round #696 (Div. 2)A. Puzzle From the Future题意: 二进制加法不进位,并且和的相邻项如果相同则只保留一项。给出一个二进制数a,要求找到一个b使它们的和最大。题解: 贪心去找,不能使项省略,对于a是0还是1分别考虑。代码:#include<bits/stdc++.h>using namespace std;const int maxn = 1e2 + 10;int t, n;string st, st1;void原创 2021-01-20 20:43:07 · 126 阅读 · 0 评论 -
Codeforces Round #688 (Div. 2) B. Suffix Operations【思维】
B - Suffix Operations题意: 给出一个数组,刚开始可以选择其中一个数变成任意的数,然后只能对数组的后缀进行加1或者减1的操作,问最少经过多少次操作才能把数组中的所有元素都变成一样的。题解: 脑子不够用,这道题真的是想了很久了。先不考虑将数字进行变换,那么答案就很明显是一个差分数组的和,然后考虑变换。如果变换第一个数字,那么减少的操作次数就是abs(a[1]−a[2])abs(a[1] - a[2])abs(a[1]−a[2])如果变换最后一个数字,那么减少的操作次数就是abs(原创 2021-01-19 20:11:19 · 85 阅读 · 0 评论 -
Codeforces Round #674 (Div. 3)题解
Codeforces Round #674 (Div. 3)A. Floor Number题意:该公寓第一层有两个房间,每上一层增加x个房间,给出一个n,求n在第几层。题解:整除一下就可以#include<bits/stdc++.h>using namespace std;const int maxn=100005;int t,n,x;int main(){ ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);原创 2020-09-30 22:20:31 · 220 阅读 · 0 评论