随笔 - 530  文章 - 0  评论 - 3  阅读 - 10098 
01 2023 档案
图的遍历
摘要:n=0 N=10000 all=0 go=[0]*N hd=[0]*N nxt=[0]*N def add_(x,y): global all all+=1 nxt[all]=hd[int(x)] go[all]=y hd[x]=all def dfs(x): print("%d "%(x)) i= 阅读全文
posted @ 2023-01-31 12:54 towboat 阅读(9) 评论(0) 推荐(0) 编辑
hdu4135
摘要:求 [a,b] 中 与n 互素的数字个数 #include <iostream> #include <algorithm> using namespace std; const int N =200; #define int long long int tot,fac[N]; int hh,q[10 阅读全文
posted @ 2023-01-26 13:28 towboat 阅读(20) 评论(0) 推荐(0) 编辑
离散化( 排序+ 二分查找)
摘要:int temp[N],a[N]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; temp[i]=a[i]; } sort(temp+1,temp+n+1); int len=unique(temp+1,temp+n+1)- 阅读全文
posted @ 2023-01-22 20:08 towboat 阅读(14) 评论(0) 推荐(0) 编辑
快读
摘要:inline int read(){ int s = 0, w = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') w = -1; for (; isdigit(c); c = getchar()) s 阅读全文
posted @ 2023-01-14 13:37 towboat 阅读(50) 评论(0) 推荐(0) 编辑
n^2 判断回文串
摘要:int test(int a,int b){ if(a>=b) return 1; if(s[a]!=s[b]) return 0; if(vis[a][b]) return pal[a][b]; vis[a][b]=1; return pal[a][b]=test(a+1,b-1); } 阅读全文
posted @ 2023-01-07 21:36 towboat 阅读(29) 评论(0) 推荐(0) 编辑
欧拉函数
摘要:对正整数 n,欧拉函数是小于等于 n 的数中与 n 互质的数的个数 性质摘要 1. a,b互质, f(a*b) =f(a)*f(b) 2. f(x^a) = (x-1)* f(x^(a-1)) 3. if i%j==0 f(i*j)= f(i) *j 4. if i%j !=0 f(i*j)=f(i 阅读全文
posted @ 2023-01-04 11:14 towboat 阅读(20) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示