摘要: codeforces ECR 169 A #include<bits/stdc++.h> using namespace std; const int maxn=50; int a[maxn]; void solve() { int n; cin>>n; for(int i=1;i<=n;i++)c 阅读全文
posted @ 2024-08-16 12:19 -风间琉璃- 阅读(4) 评论(0) 推荐(0) 编辑
摘要: A. Find K Distinct Points with Fixed Center 思路 简单构造 ,我居然在这个题上因为没看懂英文还有机翻英太过逆天导致我WA了好几发...... AC code: #include<bits/stdc++.h> #define int long long us 阅读全文
posted @ 2024-08-12 11:18 -风间琉璃- 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 欧拉筛线性筛质数 经典题解 我的乱搞筛法和欧拉线性筛法的速度对比: 模版code #include <bits/stdc++.h> using namespace std; const int maxn = 100000009; bool a[100000009]; int read() { int 阅读全文
posted @ 2024-08-09 22:36 -风间琉璃- 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 线段树维护区间方差 方差 区间方差 还教室 解题思路: 利用线段树维护 \(a_i\) 与 \(a_i^2 ( 1\leq i \leq n)\) 两个数列 ,然后使用一个 \(lazytag\) 来记录是否进行了区间加,最后输出方差的时候使用\[s^2 =\sum\limits_{i=1}^n ( 阅读全文
posted @ 2024-08-09 20:26 -风间琉璃- 阅读(1) 评论(0) 推荐(0) 编辑
摘要: GCD 的性质总结 \(gcd(a_1,a_2,......a_n)=gcd(|a_1|,|a_2|,......|a_n|)\) \(gcd(a,0)=gcd(a,a)=|a|\) \(gcd(a_1,a_2,......a_{n-1},a_n)=gcd(gcd(a_1,a_2),a_3,.... 阅读全文
posted @ 2024-08-08 21:23 -风间琉璃- 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 牛客多校 8 - A Haitang and Game Given a set \(\textstyle S\), dXqwq and Haitang take turns performing the following operations, with dXqwq going first: Fi 阅读全文
posted @ 2024-08-08 20:38 -风间琉璃- 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 小白逛公园 注意线段树的分块思维,以及分治的思维,写了好久,还看了题解 AC code #include <bits/stdc++.h> using namespace std; #define int long long // P4513 小白逛公园 int read() { int x = 0, 阅读全文
posted @ 2024-08-08 10:55 -风间琉璃- 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 给你两个正整数序列 \(a_1, \ldots, a_n\) 和 \(b_1, \ldots, b_m\) 。求每个 \(j = 1, \ldots, m\) 的最大公约数 \(a_1 + b_j, \ldots, a_n + b_j\) 。 输入 第一行包含两个整数 \(n\) 和 \(m\) ( 阅读全文
posted @ 2024-07-27 19:53 -风间琉璃- 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 【模板】线段树 1 题目描述 如题,已知一个数列,你需要进行下面两种操作: 将某区间每一个数加上 \(k\)。 求出某区间每一个数的和。 输入格式 第一行包含两个整数 \(n, m\),分别表示该数列数字的个数和操作的总个数。 第二行包含 \(n\) 个用空格分隔的整数,其中第 \(i\) 个数字表 阅读全文
posted @ 2024-07-24 19:33 -风间琉璃- 阅读(6) 评论(0) 推荐(0) 编辑
摘要: [USACO07MAR] Face The Right Way G 题目描述 Farmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, like good cow 阅读全文
posted @ 2024-07-23 09:01 -风间琉璃- 阅读(5) 评论(0) 推荐(0) 编辑