摘要:
深夜无事可干啊 C++ include using namespace std; const int maxn = 1e6+11; typedef long long ll; bitset isnprime; int prime[maxn]; int sai(int n){ isnprime[0]= 阅读全文
摘要:
这是对HDU1085的扩展,注意数组范围要4倍的n C++ include using namespace std; const int maxn = 2333; int G[2][maxn],n; int main(){ while(scanf("%d",&n)^ 1){ memset(G,0,s 阅读全文
摘要:
年轻人的第一道母函数入门题 C++ include using namespace std; const int maxn = 1000+2000+5000+1; define rep(i,j,k) for(int i = j; i a b c){ if(!a&&!b&&!c) break; mem 阅读全文
摘要:
```C++ include using namespace std; const int maxn = 1e6+11; const int N = 1e6; typedef long long ll; bitset isnprime; ll prime2[maxn 2]; int sai(){ i 阅读全文
摘要:
求∑1/i,但是范围很大 和bitmap的想法一样,分个块,均摊复杂度就降下来了 //到底排行榜上的0ms是怎么做到的? C++ include using namespace std; const int maxn = 1e6+11; const int N = 1e8; double tmp[N 阅读全文
摘要:
简单欧拉函数递推 用埃式筛会吃亏 C++ include include include include using namespace std; const int maxn = 5e6+11; typedef unsigned long long ll; ll phi[maxn]; void e 阅读全文
摘要:
欧拉函数测试题 期末考试完了做下水题 更好的方法是phi[i]==i时就直接筛选,不改了 C++ include using namespace std; const int maxn = 4e4+11;; typedef unsigned long long ll; bool isnprime[m 阅读全文
摘要:
部分还没调到满意的程度,效率比splay略好 C++ include using namespace std; const int maxn = 1e6+11; unsigned int SEED = 17; inline int Rand(){ SEED=SEED 1103515245+12345 阅读全文
摘要:
```C++ include using namespace std; const int maxn = 2e6+1e5; unsigned int SEED = 17; inline int Rand(){ SEED=SEED 1103515245+12345; return SEED; } ty 阅读全文
摘要:
实测手动实现1e7范围比内置快3倍左右 PS xjb乱敲也是可以的 C++ include unsigned int xjb=2333333; int Rand(){ return (xjb=xjb 12345+23333)%7; } int arr[33],cnt,i; int main(){ w 阅读全文
摘要:
```C++ include include include include define rep(i,j,k) for(int i = j; i n m){ rep(i,1,n)rep(j,1,m)cin a[i][j]; memset(dp,0,sizeof dp); rep(i,1,n)dp[ 阅读全文
摘要:
迭代式不知道怎么敲 DFS就很清晰 C++ include include include include include include define rep(i,j,k) for(int i = j; i =1&&i=1&&jG[i][j]) maxlen=max(maxlen,DP(x,y)+ 阅读全文
摘要:
f[i][j]:i种花放j盆的方案数 C++ include using namespace std; const int maxn = 3e2+11; const int mod = 1000007; typedef long long ll; ll f[maxn][maxn],a[maxn],n 阅读全文
摘要:
显然只需要能跑到第二个因子就赢了 需要特判非平凡因子 常数优化:不用求出所有因子,跑完第二个素数就行了 C++ include using namespace std; typedef long long ll; const int maxn = 233; ll n,cnt; ll prime[ma 阅读全文
摘要:
```C++ include using namespace std; const int maxn = 2e5+2e4+11; const int dep = 666; const int len = 30; struct AAA{ string str; int cnt; }a[maxn]; b 阅读全文
摘要:
LCA模板题 随便找的倍增模板... C++ include using namespace std; const int maxn = 1e5+11; int to[maxn que; memset(dis,0,sizeof dis); memset(fa,0,sizeof fa); memset 阅读全文
摘要:
数目规模大,尝试转换为判定性问题,那么E就不影响到网络流的复杂度了 SPFA码歪了,WA了好几发气死了 C++ include using namespace std; const int maxn = 3e5+11; const int oo = 0x3f3f3f3f; int to[maxnf) 阅读全文