Codeforces
谪星.
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #783 (Div. 2) A - C
A. Direction Change题意:给定一个n∗mn * mn∗m 的方格图,在不能连续朝同一个方向走的前提下,问从 (1,1)(1, 1)(1,1) 走到 (n,m)(n, m)(n,m) 的最少步数为多少做法:先右下右下的走,走到右边界或者下边界,步数为 (min(n,m)−1)∗2(min(n, m) - 1) * 2(min(n,m)−1)∗2 ,再往右或往下走,步数为 (max(n,m)−min(n,m))/2∗2+(max(n,m)−min(n,m))(max(n, m) - min原创 2022-04-20 09:48:24 · 112 阅读 · 0 评论 -
Educational Codeforces Round 126 (Rated for Div. 2) A - C
A. Array Balancing题意:给定一个操作,可以交换 aiaiai 和 bibibi 使得两序列相邻绝对值的和最小做法:小的放上面,大的放下面#include<bits/stdc++.h>#define int long longusing namespace std;signed main(){ ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; wh原创 2022-04-11 17:02:47 · 351 阅读 · 0 评论 -
Educational Codeforces Round 125 (Rated for Div. 2) A - C
A. Integer Moves题意:给你一个坐标 (x,y)(x, y)(x,y) ,问你从 (0,0)(0, 0)(0,0) 开始,每次走任意整数长的步,问最少需要几步可以到达做法:特判 (0,0)(0, 0)(0,0),如果可以一步到位就是1,否则是2#include<bits/stdc++.h>#define x first#define y secondusing namespace std;typedef long long LL;typedef pair<in原创 2022-03-23 11:15:32 · 483 阅读 · 0 评论 -
Codeforces Round #778 (Div. 1 + Div. 2) A - C
A. Maximum Cake Tastiness题意:给你一个长度为 nnn 的序列,定义这个序列的权值为相邻两个元素的和,给你一次反转序列的操作,问你该序列的最大权值为多少做法:输出最大值和次大值的和#include<bits/stdc++.h>#define x first#define y secondusing namespace std;typedef long long LL;typedef pair<int, int> PII;const int N原创 2022-03-21 11:06:49 · 531 阅读 · 0 评论 -
Codeforces Round #774 (Div. 2) A - C
A. Square Counting题意:给你一个长度为 nnn 的序列,给出总和 sss ,问其中最多能含多少个 n2n^2n2做法:直接输出 s/n2s / n ^2s/n2 即可,因为序列元素可以是0#include<bits/stdc++.h>#define x first#define y secondusing namespace std;typedef long long LL;typedef pair<int, int> PII;const int原创 2022-03-07 15:30:35 · 204 阅读 · 0 评论 -
Codeforces Round #775 (Div. 2) A - C
A. Game题意:你可以在陆地上行走,遇到水坑必须跳过去,且你只能跳一次,问走到最后的最小花费做法:从前往后找到第一个0和从后往前找到第一个0,然后位置相减即可#include<bits/stdc++.h>#define x first#define y secondusing namespace std;typedef long long LL;typedef pair<int, int> PII;const int N = 100010;const int原创 2022-03-07 15:04:29 · 93 阅读 · 0 评论 -
Codeforces Round #773 (Div. 2) A - C
A. Hard Way题意:给你一个三角形的三个点,问你有多长的边上的点沿着 y=0y = 0y=0 这条线往下走会穿过三角形做法:其实就是问你这个三角形是否存在一条水平边,且这条边是三角形区域的上边界#include<bits/stdc++.h>#define x first#define y secondusing namespace std;typedef long long LL;typedef pair<int, int> PII;const int N原创 2022-02-24 17:37:05 · 563 阅读 · 0 评论 -
Codeforces Round #771 (Div. 2) (A - C)
A. Reverse题意:给你一个排列和一次反转区间的操作,问操作后的最小字典序排列做法:枚举找到第一个和编号不符的位置,然后再找到这个编号的位置,然后反转这个区间即可#include<bits/stdc++.h>using namespace std;int main(){ int t; cin >> t; while (t--) { int n; cin >> n; vect原创 2022-02-15 13:37:40 · 354 阅读 · 0 评论