理论知识C系列
快乐平凡的小熙
此账号不再更新
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
lower_bound和upper_bound的用法解析——只比二分查找慢一点的利器
lower_bound,upper_bound库函数用法详细延伸拓展!!!!!!原创 2021-11-19 09:39:55 · 1582 阅读 · 0 评论 -
函数prev_permutation和next_permutation的用法分辨
补充条件:m(arry存储)个里面选取n个。同时设置布尔数组(m个的) 以后统一设置前n个数组为1,用prev_permutation 例子:洛谷1249 #include<bits/stdc++.h> using namespace std; bool isnprimes[100000000];int primes[10000000];int cnt,sum;int count1; int k,n; void ola(int n) { for(int i=2;i<=n;i++)原创 2021-11-15 23:11:01 · 4875 阅读 · 0 评论 -
memset函数的用法
①批量从一开始替换数组的值 #include<bits/stdc++.h> using namespace std; int main() { char str[]="hello thank you"; memset(str,'0',5); printf("%s",str); return 0; } ②清空字符串数组——用‘/0’ #include<bits/stdc++.h> using namespace std; int main() { char str1原创 2021-11-02 23:23:20 · 833 阅读 · 0 评论 -
质数的挑选
int isnprimes[max]; int choose(int n) { for(int i=2;i<=n;i++) if(!isnprimes[i]) for(int j=i+i;j<=n;j++) ismprimes[j]=1; } 要点一:0——是质数;1——是合数; 要点二:!isnprimes如果脑袋转不过来的话直接isnprimes==0; ...原创 2021-11-02 10:03:10 · 184 阅读 · 0 评论 -
sprintf函数的用法
正确:sprintf(str,"%d",i); 错误:sprintf(str,"%d",10)原创 2021-10-28 09:02:01 · 254 阅读 · 0 评论
分享