摘要:
int b[N+2], pm[N+2],tot=0; void init(){ b[1]=1; for(int i=2;i<=N;i++){ if(b[i]) continue; pm[++tot]= i; for(int j=2;j*i<=N;j++) b[j*i]=1; } } const in 阅读全文
posted @ 2022-10-12 23:16
towboat
阅读(35)
评论(0)
推荐(0)
摘要:
算法求解了不定方程 ax+by=gcd(a,b) (1) 的一组解x0,y0 void gcd(int a,int b,int &d,int &x,int &y){ if(b==0){ d=a; x=1,y=0; return ; } gcd(b,a%b,d,y,x); y-=x*(a/b); } 阅读全文
posted @ 2022-10-12 23:05
towboat
阅读(35)
评论(0)
推荐(0)
摘要:
操作:从字符串a中扣除给定的子串b(如hebheof 和 he ,结果 --bheof或heb--of 问直到无法操作时,至少需要几次 #include<iostream> #include <vector> #include <cstring> using namespace std; const 阅读全文
posted @ 2022-10-12 20:31
towboat
阅读(30)
评论(0)
推荐(0)
浙公网安备 33010602011771号