算法题
哈登小球迷
这个作者很懒,什么都没留下…
展开
-
多种判断素数的时间复杂度及模板
三种判断素数的方法#include<iostream>#include<time.h>#include<math.h>using namespace std;bool prime1(long n){ long i; for(int i=2;i<n;i++){ if(n%i==0) return false; } return true;}void PrimeTime1(long n){ clock_t t; long.原创 2022-03-17 11:53:49 · 859 阅读 · 1 评论 -
C. Factorials and Powers of Two(最详细二进制枚举、爆搜)
最详细最全面原创 2022-03-17 11:44:15 · 651 阅读 · 5 评论 -
P1657 选书详细题解
(P1657选书)https://www.luogu.com.cn/problem/P1657一、题面二、详细代码及思路#include<iostream>using namespace std;const int N = 25;int num[N][3], mark[N];int n; int ans = 0;void dfs(int step) { //如果到了n个学生就直接可以输出了,应为是从1开始的到n,n+1并不会进行搜索 if (step.原创 2021-12-16 20:47:34 · 520 阅读 · 6 评论