- 博客(12)
- 收藏
- 关注
原创 AtCoder Beginner Contest 134 F - Permutation Oddness
Contents问题重现数据范围样例InputOutput思路参考问题重现原题链接设 P=(p1,p2,p3,...,pn)P = (p_1, p_2, p_3, ..., p_n)P=(p1,p2,p3,...,pn) 是{1,2,3,...,n}\{1,2,3,...,n\}{1,2,3,...,n}的排列,定义Oddness:=∑∣pi−i∣Oddness := \sum |p_i - i|Oddness:=∑∣pi−i∣求满足Oddness=kOddness = kOddnes
2021-11-19 23:16:26
654
原创 Codeforces-753 (Div3)
Link to B: Odd GrasshopperStarting with a even number coordinate, first step you'll have your number decreased by 1, and later every 4 steps decreased by 4. And if starting with odd number, instead of decreasing, you canincreasing the coordinate by 1 in.
2021-11-03 09:44:40
282
原创 Codeforces-752
Link to A:EraInsert number into the array so that a[i] <= iassume k's number has been inserted before index j,1) a[j] <= k+ j no need to add more numbers bofore a[j] => k =k (when a[j] - j ...
2021-11-02 17:44:38
173
原创 Codesforces - #672/D.
https://codeforces.com/contest/1420/problem/Dhttp://Link to CodeforcesGiven segment: s[0], s[1], ..., s[k]If each segment need to have at least one intersection point <=>max(l[s[0]], l[s[1]], l[s[2]], ... , l[s[k]]) <= min(r[s[0]], r[s[1]],.
2021-11-01 22:09:52
128
原创 macOS安装Homebrew连接错误 - SSL_ERROR_SYSCALL
According to https://brew.sh, installing homebrew only require one line of terminal command:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Yet, connection error may occur in some countriesor regions...
2021-10-16 23:03:56
773
原创 C++中满足一定条件的输出技巧
字符串 按行输入并输出#include <bits/stdc++.h> using namespace std; int main() { string line; getline(cin, line); cout<<line; return 0; }分词通过streamstring可以将一行输入,按照空格、制表符等空字符的方式进行分词如下:#include <bits/stdc++.h>using name...
2021-07-06 15:43:32
1317
原创 2021ACM竞赛班训练(十一)
A题:Leo的分手厨房原题链接思路:1、通过输入记录有哪些菜需要完成,对他们的完成时间累加一次即可(所有同一类型的菜可在相同时间段完成)。代码:#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin>>n>>m; vector<int> time; vector<int> vis; for(int i
2021-06-07 07:51:51
232
原创 2021年ACM竞赛班训练(十一)
F题:奖学金原题链接思路:1、对所有学生按照给定的优先级进行排序,即先看总分,(若总分相同)再看语文分数,(若语文也相同)再看学号。2、快速排序算法sort支持对结构体排序,我们只需要构造出一个满足上述优先级的布尔函数cmp().#include <bits/stdc++.h>using namespace std;struct node//传建一个吉利的结构体数组用来储存学生成绩{ int id; int x1, x2, x3; int tot;}p[
2021-06-05 12:03:53
228
原创 2021年ACM竞赛班训练(十一)
2021年ACM竞赛班训练(十一)D题:最少步数原题链接思路:1、对于A、B两点的坐标(Xi,Yi)(Xi, Yi)(Xi,Yi), 我们需要计算通过走“日”字型或走“田”字型路径到达(1,1)(1, 1)(1,1)的最少步数。这个问题等价于从(1,1)(1, 1)(1,1)出发,以日、田路径,到达某一点P(x,y)P(x, y)P(x,y) 的最少步数问题。2、通过广度优先搜索,可以得到从起点(1,1)(1, 1)(1,1) 出发,到达定义域D:{(x,y)∣1≤x≤100,1≤y≤100}\m
2021-06-03 20:54:32
217
原创 辗转相除法
2021年ACM竞赛班训练(三)B题: 路径原题链接思路:1、对于元素(a, b)使用四种映射f1(a,b)=(a+b,b)f_1(a, b) = (a+b, b)f1(a,b)=(a+b,b)f2(a,b)=(a−b,b)f_2(a, b) = (a-b, b)f2(a,b)=(a−b,b)f3(a,b)=(a,a+b)f_3(a, b) = (a, a+b)f3(a,b)=(a,a+b)f4(a,b)=(a,a−b)f_4(a, b) = (a, a-b)f4(a,b)=(a,a
2021-04-11 20:35:40
124
原创 大素数检测: Miller_Rabin算法
2021年ACM竞赛班训练(三)A题: 验证哥德巴赫猜想原题链接思路:1、原初哥德巴赫猜想的现代陈述为:任一大于5的整数都可以拆成三个质数之和。通过观察样例输入,不妨假设输入nnn足够大时:n=a+b+cn = a + b + cn=a+b+c 其中 a,ba, ba,b 在小质数内可实现 (a,b∈(2,600)a,b \in (2, 600)a,b∈(2,600),可利用(埃拉托斯特尼)筛法得到该范围内素数表).2、对于较大数 c=n−a−bc = n - a - bc=n−a−b 的素
2021-04-11 19:32:25
869
原创 Basic Mathematics for Linear Regression and Least Square Method
Basic Mathematics and Statistics Preparation for Linear RegressionContentBasic Mathematics and Statistics Preparation for Linear RegressionBackgroundMathematical ApproachIntroduction to Least SquaresApplicationReferenceBackgroundIn statistics, linear r
2021-02-11 18:22:41
330
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人