随笔分类 - ACM模板
摘要:The 2021 ICPC Asia Regionals Online Contest (II),PTA #include <bits/stdc++.h> //#define endl '\n' #define lose {printf("NO\n");return;} #define win {p
阅读全文
摘要://https://nanti.jisuanke.com/t/A2022 #include <bits/stdc++.h> //#define endl '\n' #define lose {printf("NO\n");return;} #define win {printf("YES\n");r
阅读全文
摘要:struct myComp { bool operator() (const int &a, const int &b) { if (ac[a]<ac[b]) return a; else if (ac[a]==ac[b]&&pen[a]>=pen[b]) return a; return fals
阅读全文
摘要:int divide(int number) { int tot = 0; for (int i = 2; i <= number; i++) { if (number % i == 0) { tot++; prime[tot] = i; while (number % i == 0) { prim
阅读全文
摘要:LL fenkuai(LL k){ LL j; LL ans=0; for (LL i=1;i<=k;i=j+1){ j=n/(n/i); ans+=(j-i+1)%mod*((n/i)%mod)%mod; ans%=mod; } return ans; }
阅读全文
摘要:线性筛素数 int pnum=0; int pa[maxn]; bool pvis[maxn]; void prime_init() { memset(pvis,0,sizeof(pvis)); FOR(i,2,MAX) { if (!pvis[i]) { pvis[i]=1; pnum++; pa
阅读全文
摘要:"https://codeforces.com/contest/1324/problem/F" description you are given a tree, in which the vertices are all printed either black or white. , find
阅读全文
摘要:int add(int a,int b) { int c=(a+b); if (c>=mod) c-=mod; return c; } int mul(int a,int b) { ll c=1ll*a*b; return c-c/mod*mod; } int fpow(int x,int powe
阅读全文
摘要:1 D void initRMQ(int n) { int MAX=(int)log2(n); FOR(i,1,n) { f[i][0]=a[i]; } FOR(j,1,MAX) { FOR(i,1,n) if (i+(1<<(j-1))<=n) { f[i][j]=max(f[i][j-1],f[
阅读全文
摘要:``` #include using namespace std; const int maxn=2e5+10; int fi[maxn],ne[maxn],v[maxn],w[maxn]; struct re { int x,y,z; }; re a[maxn]; int fa[maxn]; int t=-1; bool cmp(re a,re b) { return a.z>n>>m; for
阅读全文

浙公网安备 33010602011771号