随笔分类 -  数学

摘要:点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n; vector<int> primes; bool st[N]; void get_prim 阅读全文
posted @ 2022-08-07 23:38 wKingYu 阅读(76) 评论(0) 推荐(0)
摘要:全集 - 集合的补集 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e5 + 10; const LL mod = 100003; LL n, m; LL qmi(LL 阅读全文
posted @ 2022-08-03 23:30 wKingYu 阅读(32) 评论(0) 推荐(0)
摘要:构造 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n; vector<int> primes; bool st[N]; void get_p 阅读全文
posted @ 2022-08-03 23:05 wKingYu 阅读(51) 评论(0) 推荐(0)
摘要:点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n; vector<int> primes; bool st[N]; void get_prim 阅读全文
posted @ 2022-08-03 22:44 wKingYu 阅读(38) 评论(0) 推荐(0)
摘要:分治 递归 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e5 + 10; const LL mod = 9901; LL a, b; LL qmi(LL a, LL 阅读全文
posted @ 2022-07-23 10:55 wKingYu 阅读(41) 评论(0) 推荐(0)
摘要:点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; void solve() { LL p, q, b; scanf("%lld %lld %lld", & 阅读全文
posted @ 2022-06-26 22:02 wKingYu 阅读(91) 评论(0) 推荐(0)
摘要:数论 + 贪心 点击查看代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e6 + 10; int n; void solve() { cin >> n; int res = 1, 阅读全文
posted @ 2022-06-26 13:04 wKingYu 阅读(44) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> #include<cstring> #include<unordered_set> using namespace std; const int N = 110; int n; int f[N]; int sg(int x) { if (f[x] 阅读全文
posted @ 2022-05-16 00:24 wKingYu 阅读(27) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> #include<cstring> #include<unordered_set> using namespace std; const int N = 110, M = 1e4 + 10; int k, n; int s[N], f[M]; // 阅读全文
posted @ 2022-05-15 22:15 wKingYu 阅读(61) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> using namespace std; int main() { int n; cin >> n; int res = 0; for (int i = 1; i <= n; i ++) { int x; scanf("%d", &x); if ( 阅读全文
posted @ 2022-05-15 20:30 wKingYu 阅读(58) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> using namespace std; int main() { int n; cin >> n; int res = 0; while (n --) { int x; scanf("%d", &x); res ^= x; } if (res) 阅读全文
posted @ 2022-05-15 17:52 wKingYu 阅读(52) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> using namespace std; typedef long long LL; const int N = 20; int n, m; int p[N]; int main() { cin >> n >> m; for (int i = 0; 阅读全文
posted @ 2022-05-14 21:54 wKingYu 阅读(30) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> using namespace std; typedef long long LL; const int mod = 1e9 + 7; int qmi(int a, int k) { int res = 1; while (k) { if (k & 阅读全文
posted @ 2022-05-14 21:05 wKingYu 阅读(51) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> #include<vector> using namespace std; const int N = 5e3 + 10; int primes[N], cnt, sum[N]; bool st[N]; void get_primes(int n) 阅读全文
posted @ 2022-05-14 17:13 wKingYu 阅读(55) 评论(0) 推荐(0)
摘要:复杂度 $ g(n) \ log(n) $ (来自 OI Wiki) 总体复杂度 $ 20 \times 10^{5} \times log(10^{5}) \times log(10^{18}) = 4 \times 10^{7} $ 点击查看代码 #include<iostream> using 阅读全文
posted @ 2022-05-14 15:53 wKingYu 阅读(76) 评论(0) 推荐(0)
摘要:预处理 复杂度 \(O(n \cdot log(n))\) 总体复杂度 \(10^{5} \times log(10^{9}) = 3 \times 10^{6}\) 点击查看代码 #include<iostream> using namespace std; typedef long long L 阅读全文
posted @ 2022-05-14 13:00 wKingYu 阅读(76) 评论(0) 推荐(0)
摘要:递推 复杂度 \(O(n^{2})\) 总体复杂度 \(2000^{2} = 4 \times 10^{6}\) 点击查看代码 #include<iostream> using namespace std; const int N = 2e3 + 10, mod = 1e9 + 7; int c[N 阅读全文
posted @ 2022-05-14 11:29 wKingYu 阅读(31) 评论(0) 推荐(0)
摘要:复杂度 \(O(n^{3})\) 总体复杂度 \(100^{3} = 1 \times 10^{6}\) 点击查看代码 #include<iostream> using namespace std; const int N = 110; int n, a[N][N]; int gauss() { i 阅读全文
posted @ 2022-05-12 17:53 wKingYu 阅读(64) 评论(0) 推荐(0)
摘要:复杂度 \(O(n^{3})\) 总体复杂度 \(100^{3} = 1 \times 10^{6}\) 点击查看代码 #include<iostream> #include<cmath> using namespace std; const int N = 110; const double ep 阅读全文
posted @ 2022-05-12 17:26 wKingYu 阅读(43) 评论(0) 推荐(0)
摘要:点击查看代码 #include<iostream> using namespace std; typedef long long LL; LL exgcd(LL a, LL b, LL & x, LL & y) { if (!b) { x = 1, y = 0; return a; } LL d = 阅读全文
posted @ 2022-05-11 23:38 wKingYu 阅读(57) 评论(0) 推荐(0)