摘要: 这是一种在线性时间复杂度里求乘法逆元的方法 long long inv[maxn]; inv[1]=1; for(long long i=2;i<maxn;i++){ inv[i]=mod-((mod/i)*inv[mod%i])%mod;//此处保证为正 } 阅读全文
posted @ 2020-10-13 14:20 yesuweiYYYY 阅读(55) 评论(0) 推荐(0) 编辑
摘要: freopen("t.in","r",stdin); freopen("t2.out","w",stdout); 阅读全文
posted @ 2020-10-13 14:14 yesuweiYYYY 阅读(91) 评论(0) 推荐(0) 编辑
摘要: int f[maxn][30]; int depth[maxn]; void bfs(){//遍历 queue<int>q; q.push(s); depth[s]=1; f[s][0]=s; while (!q.empty()){ int u=q.front();q.pop(); for(int 阅读全文
posted @ 2020-10-12 10:38 yesuweiYYYY 阅读(89) 评论(0) 推荐(0) 编辑
摘要: stl 的set容器很好用,非常有必要掌握 // ascending red black tree // cross set_intersection difference set_difference union set_union multiset<int>st;//多重集 s.begin(); 阅读全文
posted @ 2020-10-12 10:37 yesuweiYYYY 阅读(81) 评论(0) 推荐(0) 编辑
摘要: void in(int &x){ int y=1;char c=getchar();x=0; while(c<'0'||c>'9'){if(c=='-')y=-1;c=getchar();} while(c<='9'&&c>='0'){ x=(x<<1)+(x<<3)+c-'0';c=getchar 阅读全文
posted @ 2020-10-12 10:25 yesuweiYYYY 阅读(78) 评论(0) 推荐(0) 编辑
摘要: int d[maxn];bool vis[maxn]; struct Edge{ int to,v; }; vector<Edge>g[maxn]; void spfa(){ deque<int>q; memset(d,0x3f,sizeof(d)); d[1]=0; q.push_back(1); 阅读全文
posted @ 2020-10-12 09:42 yesuweiYYYY 阅读(56) 评论(0) 推荐(0) 编辑
摘要: getline()可以用来处理大模拟的问题。 getline(cin,str,'\n'); 阅读全文
posted @ 2020-10-09 18:50 yesuweiYYYY 阅读(61) 评论(0) 推荐(0) 编辑
摘要: zwk线段树,即非递归的线段树。优点:常数小,代码短。缺点:貌似不太好处理区间修改的操作。代码: //建树 inline void Build(int n){ for(M=1;M<n;M<<=1);//找到M for(int i=M+1;i<=M+n;i++)cin>>d[i];//输入 for(i 阅读全文
posted @ 2020-10-09 18:38 yesuweiYYYY 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 山东大学数据库实验 2-1 create or replace view test2_01 as (select sid,name from pub.student where sid not in (select sid from pub.student_course) ) 2-2 create 阅读全文
posted @ 2020-10-07 22:04 yesuweiYYYY 阅读(443) 评论(0) 推荐(1) 编辑