自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 ACM比赛记录

比赛记录及题解

2021-06-21 17:22:43 156

原创 Educational Codeforces Round 117 (Rated for Div. 2)【A - C】

被二分干碎了…A Distance观察规律,判断一下奇偶就行,如果 x+yx+yx+y 为奇数势必不能分一半出来,如果是偶数,则构造偶数坐标即可。#include <bits/stdc++.h>using namespace std;#define endl '\n'#define ll long longvoid solve() { int x, y; cin >> x >> y; int z = x + y; if(z & 1) {

2021-11-23 00:34:36 451

原创 Codeforces Round #735 (Div. 2)(A-D)

Cherry题意:给定一个长度为n的数字序列a,最大化子序列中的最大值*最小值的结果是多少题解:官方题解好像写的很复杂,我说一下我个人的思路,比如对于长度为3的数字序列:a1,a2,a3a_1,a_2,a_3a1​,a2​,a3​,他们之间的大小关系一共有六种:a1<a2<a3,MAX=a2∗s3a_1 < a_2 < a_3,MAX = a_2 * s_3a1​<a2​<a3​,MAX=a2​∗s3​a1<a3<a2,MAX=a3∗a2a_..

2021-07-30 13:43:20 115

原创 Codeforces Global Round 15(A-D)

这次对劲了…A. Subsequence Permutation题意:对于一个字符串,需要对哪些位置进行排序,使得整体有序思路:直接排序再对比即可代码#include <bits/stdc++.h>#define int long long#define pii pair<int, int>using namespace std;const int N = 1e6 + 10;char s[N], f[N];inline void solve() {

2021-07-26 01:12:59 229

原创 Codeforces Round #734 (Div. 3)(A-D2)

最近打的超级差,实力和状态都不如以前,设立计划,往前刷20场cf,目标还是这个暑假rating上1900,并且将基础课算法刷完,这个暑假的重心放在提升思维和对基础算法的模板的熟悉。等到思维提升了再去加强算法的掌握度,时刻注意不要急慢慢来,当初不也是高三一个学期提升200分嘛,稳扎稳打,又不是智商问题大概这就是杯爷的赛后cf吧,我这补题,人在那叉人A - Polycarp and Coins题意:求x + 2y = c思路:直接计算即可代码#include <bits/std

2021-07-24 02:35:58 263 1

原创 Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)(A-D)

A. Digits Sum题意是询问1~n中,有多少个数x,满足x的各个数位之和小于x+1数位之和,因为只有9满足,并且每10个数中只有一个9,所以n/10+最后一位是否为9即为答案代码:#include <bits/stdc++.h>using namespace std;#define int long longconst int N = 1e6 + 10;inline void solve() { int n; cin >> n; int

2021-07-23 13:41:33 141

原创 Educational Codeforces Round 111 (Rated for Div. 2)(A - C)

A. Find The Array思路:要使得序列长度尽可能少,那么我们我们每一次的增值就要尽可能大,按照题意即为2,即1,3,5,……,这样的排列,直到≥n为止,这个时候的值只有两种情况,①=n,②=n+,此时将最后一项减一即可代码:#include <bits/stdc++.h>#define int long longusing namespace std;int t, n;inline void solve() { cin >> n; i

2021-07-15 18:44:00 99

原创 Codeforces Round #732 (Div. 2)【A - D】

A. AquaMoon and Two Arrays题意:给定一个两个长度为n的数字序列A,B,判断是否可以通过对A进行若干次以下操作得到B。操作:任选两个下标1<=i!=j<=n,a[i]++,b[j]–思路:直接判断需要加的次数和减的次数是否一致即可#include <bits/stdc++.h>#define int long long#define pii pair<int, int>using namespace std;const ..

2021-07-13 17:18:06 150

原创 Codeforces Round #731 (Div. 3)【A - E】

A. Shortest Path with Obstacle题意:给出三个点坐标A,B,C,求在不经过C点的条件下,A->B的最短路径长度思路:首先考虑一般情况,ans = abs(xa - xb) + abs(ya - yc),判断C是否与A、B共线的同时且在A、B中间,这种情况需要ans+2.代码:inline void solve() { ll xa, ya, xb, yb, xc, yc; cin >> xa >> ya >&g

2021-07-11 16:56:01 493 2

原创 Codeforces Round #730 (Div. 2)【A - D1】

A. Exciting BetsWelcome to Rockport City!It is time for your first ever race in the game against Ronnie. To make the race interesting, you have bet a dollars and Ronnie has bet b dollars. But the fans seem to be disappointed. The excitement of the fans

2021-07-09 01:52:55 342

原创 Codeforces Round #728 (Div. 2)【A - C】

A. Pretty PermutationsThere are n cats in a line, labeled from 1 to n, with the i-th cat at position i. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also

2021-07-06 12:55:24 140

原创 Codeforces Round #729 (Div. 2)

A思路:水题,判断奇数偶数出现的次数是否一致即可代码#include <bits/stdc++.h>#define ll long longusing namespace std;const ll N = 1e6 + 10, mod = 1e9 + 7;ll t, n, m, x[N];inline void solve() { cin >> n; ll s1 = 0, s2 = 0; for(int i = 1; i <= n * 2; i+

2021-07-05 17:57:43 250

原创 Codeforces Round #727 (Div. 2)

A题意:定义每个人的贡献为当他结束时,已经开始但没结束的人数。求所有人的总贡献值思路:推公式,由于每个人运动时间、开始时间间隔都相等,所以一个人的最大贡献就是t/x,之后就是依次递减,形成一个首项为t/x - 1,公差为1的等差数列,计算两段值即可。代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;inline void solve() { ll ans = 0, n, x, t

2021-06-21 17:11:38 137

原创 Codeforces Round #726 (Div. 2)

又是天崩开局…A题意:给定一个数字序列,求至少往里面加入多少个非负整数就能使整个序列的算术平均值为1思路:将数字序列求和得到sum,以sum与n的关系分类讨论首先,当sum < n时,只需要添加一个n - sum + 1即可其次,当sum >= n时,只需要添加sum - n个0即可代码#include <bits/stdc++.h>using namespace std;typedef long long ll;ll t, n, m;inline v

2021-06-19 19:53:39 126

原创 Educational Codeforces Round 109 (Rated for Div. 2)

A思路:看数据大小为k <= 100,所以直接枚举水和精华的比例即可,O(n^2)代码:#include <bits/stdc++.h>using namespace std;int main() { int t; cin >> t; while(t--) { int k; cin >> k; int ans = 9999999; for(int i = 0; i <= 100; i++) for(int j = 0; j

2021-06-18 14:45:01 76

原创 Codeforces Round #725 (Div. 3)

A找到最大值和最小值所在的位置l, r,比较max(l, r), l + n - r + 1, n - min(l, r) + 1的最小值即可代码:#include <bits/stdc++.h>#define rs register#define il inline#define ll long long#define _for(i, a, b) for(rs int i = a; i <= b; i++)using namespace std;const

2021-06-15 00:40:24 163

原创 Codeforces LATOKEN Round 1 (Div. 1 + Div. 2)

这次打的好差…暴露出了交互题和图论的知识点不熟悉,还有对题目的思考不够简洁A思路:由于满足情况的棋盘只有两种情况:第一种:RWRWRWRWR第二种:WRWRWRWRW可以发现其中存在一个规律就是字符R或者字符W所在的格子的横纵坐标之和为奇数或偶数。最最核心的思想就是,输出棋盘是哪个类型的,但由于存在“.”的情况,所以我们不能直接判断是哪种类型,于是我们采取先判断它不是哪种类型的,再输出另外的类型。

2021-06-15 00:39:32 343

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除