随笔分类 -  生命不息,蒜法不止

摘要:P2671 [NOIP2015 普及组] 求和 1 //(x+z)*(num[x]+num[z])= 2 //(x1+x2)*(y1+y2)+(x1+x3)*(y1+y3)+(x2+x3)*(y2+y3) 3 //=x1*(y1*(n-2)+y1+y2+...+yn) 4 //+x2*(y2*(n- 阅读全文
posted @ 2022-09-29 14:50 藏狐永不止步 阅读(118) 评论(0) 推荐(0)
摘要:这两天回头大复习,做了一下洛谷的一道题 知识点是手写快排加分治 P1923 【深基9.例4】求第 k 小的数 自己写的代码交了20篇整才照着题解写出来篇AC的(太屑了 然而还有好多问题没有闹明白 暂且记录一下 1 //AC代码 2 //感觉此题是道玄学题 3 #include <bits/stdc+ 阅读全文
posted @ 2022-09-22 17:20 藏狐永不止步 阅读(61) 评论(0) 推荐(0)
摘要:KMP: 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn=1e6+5; 4 char a[maxn],b[maxn],aa[maxn],bb[maxn]; 5 //aa,bb为输入的字符串 6 //为了方便KMP的 阅读全文
posted @ 2022-09-13 18:20 藏狐永不止步 阅读(62) 评论(0) 推荐(0)
摘要:相关链接:https://www.cnblogs.com/TFLSc1908lzs/p/13531804.html 满分代码: 1 #include <bits/stdc++.h> 2 using namespace std; 3 int n,tot; 4 int ans[105][1000005] 阅读全文
posted @ 2022-09-11 23:02 藏狐永不止步 阅读(67) 评论(0) 推荐(0)
摘要:P3383 【模板】线性筛素数 来源:洛谷 https://www.luogu.com.cn/problem/P3383 这题考 [素数筛] ,但数据范围很毒瘤,100%数据n=10^8,意味着只有 [线性筛] 才能AC 以下提供3种素数筛法 ①朴素算法(时间复杂度O(n*sqrt(n)) 1 #i 阅读全文
posted @ 2021-08-19 23:28 藏狐永不止步 阅读(155) 评论(1) 推荐(0)
摘要:1 #include <bits/stdc++.h> 2 #include <windows.h> 3 using namespace std; 4 int main(){ 5 srand((int)time(0)); 6 system("color 0A"); 7 while(1){ 8 9 in 阅读全文
posted @ 2021-07-11 20:23 藏狐永不止步 阅读(597) 评论(0) 推荐(0)