摘要: #include<bits/stdc++.h> #define N 39989 using namespace std; const int mod=39989; const int modd=1e9; struct Seg { double k,b; Seg(){} Seg(int x0,int 阅读全文
posted @ 2020-10-13 20:07 yesuweiYYYY 阅读(85) 评论(0) 推荐(0) 编辑
摘要: ``` /* * 辛普森积分公式:sum(l,r)=( f(l)+f(r)+4*f((l+r)/2) ) * (r-l) / 6 * 解: 对 f 函数在 (l,r) 的积分可以用 以上函数拟合 * * 欲对 (l,r) 的一段函数积分并给出了精度要求 * 可以对此段区间,递归使用上述公式(以设置的 阅读全文
posted @ 2020-10-13 16:36 yesuweiYYYY 阅读(392) 评论(0) 推荐(0) 编辑
摘要: bool isP[Maxn]; long long Prime[Maxn],cnt=0; void GetPrime(){ for(long long i=1;i<Maxn;i++) isP[i]=1; isP[1]=0; for(long long i=2;i<Maxn;i++){ if(isP[ 阅读全文
posted @ 2020-10-13 16:33 yesuweiYYYY 阅读(68) 评论(0) 推荐(0) 编辑
摘要: vector<int>v; void init(){ sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); } int getid(int x){ return lower_bound(v.begin(),v.end 阅读全文
posted @ 2020-10-13 16:13 yesuweiYYYY 阅读(65) 评论(0) 推荐(0) 编辑
摘要: int ppo(int x,int p){ int t=x,res=1; while(p>0){ if(p&1)res=(res*t)%mod; t=(t*t)%mod; p>>=1; } return res%mod; } 阅读全文
posted @ 2020-10-13 16:10 yesuweiYYYY 阅读(55) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h>using namespace std;const int maxn=5e5+10;void in(int &x){ int y=1;char c=getchar();x=0; while(c<'0'||c>'9'){if(c=='-')y=-1;c=g 阅读全文
posted @ 2020-10-13 16:06 yesuweiYYYY 阅读(96) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; const int maxn=5e5+10; vector<int>g[maxn]; int head[maxn],tot; void add(int fr,int to){ g[fr].push_back(t 阅读全文
posted @ 2020-10-13 15:57 yesuweiYYYY 阅读(185) 评论(0) 推荐(0) 编辑
摘要: typedef struct P { double x,y; }P; /*bool cmp1(P a,P b)//在这里一定要注意 atan2函数y写在逗号前 返回的极角范围为-π~π { if(atan2(a.y,a.x)==atan2(b.y,b.x))return a.x<b.x; else 阅读全文
posted @ 2020-10-13 15:49 yesuweiYYYY 阅读(99) 评论(0) 推荐(0) 编辑
摘要: dp[2]; dp[n&1]=dp[(n+1)&1] 阅读全文
posted @ 2020-10-13 15:21 yesuweiYYYY 阅读(74) 评论(0) 推荐(0) 编辑
摘要: struct edge{ int u,v,value; bool operator < (const edge &t){ return value<t.value; }}e[maxn];int fath[maxn];int find(int x){ return x == fath[x] ? x : 阅读全文
posted @ 2020-10-13 15:18 yesuweiYYYY 阅读(138) 评论(0) 推荐(0) 编辑
摘要: long long sum[maxn*4],lazy[maxn*4];long long a[maxn];void PushUp(long long rt){sum[rt]=sum[rt<<1]+sum[rt<<1|1];}//重置当前节点(rt)的信息void PushDown(long long 阅读全文
posted @ 2020-10-13 14:40 yesuweiYYYY 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 选块翻译:ctrl+alt+f 缩进:tab 取消缩进:shift + tab 代码规范化:ctrl+alt+l 阅读全文
posted @ 2020-10-13 14:32 yesuweiYYYY 阅读(257) 评论(0) 推荐(0) 编辑
摘要: long long cnt=1; long long sum[maxn*150],lazy[maxn*150],Lnode[maxn*150],Rnode[maxn*150]; void PushUp(long long rt){sum[rt]=sum[Lnode[rt]]+sum[Rnode[rt 阅读全文
posted @ 2020-10-13 14:28 yesuweiYYYY 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 下面是ACM比赛中常用的几个库 #include<bits/stdc++.h> #include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cmath> #include <deque 阅读全文
posted @ 2020-10-13 14:22 yesuweiYYYY 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 这是一种在线性时间复杂度里求乘法逆元的方法 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) 编辑