10 2017 档案
摘要:#include #include #include using namespace std; const int N=40010; int n,a[N],t[N]; long long ans; inline int read(){ char c; int x=0; c=getchar(); while(!isdigit(c))c=getchar(); ...
阅读全文
摘要:#include #include using namespace std; long long n,k,ans; string m; int main(){ cin>>m>>k; long long x=0,sum=0,y=1; for(int i=0;i=k)break; y*=10; } if(i==1001){printf("...
阅读全文
摘要:#include #include using namespace std; int m,cnt,a[1000000]; int main(){ scanf("%d",&m); while(m>0){ a[++cnt]=(m+1)>>1; m>>=1; } printf("%d\n",cnt); for(int i=c...
阅读全文
摘要:#include #include #define reg register using namespace std; const int N=14; const int S=(1>1&i)); f[0][0]=1; for(reg int i=1;i<=n;i++) for(reg int j=0;j<s;j++) if(g[j] &...
阅读全文
摘要:#include #include #define regint register int using namespace std; long long n,k,p[1000010],cnt,sum[1000010],ans=1e18; long long check(long long n,long long k){ long long cnt=0; for(n/=k;n...
阅读全文
摘要:#include using namespace std; double ans; int n; int main(){ scanf("%d",&n); double ret=420000.00/n; for(register double i=1;i<=n;i++){ ans+=ret; ret-=ret*0.5/i; } ...
阅读全文
摘要:#include #include #include using namespace std; struct _zz{int now,a,b,c,num;}; bool operator y.num;} priority_queue,less > q; int n,m; int main(){ scanf("%d%d",&n,&m); while(n--){ ...
阅读全文
摘要:#include #include using namespace std; int a[100005],b[100005],to[100005],i,n; priority_queue,vector >,greater > >q; int main(){ scanf("%d",&n); for(i=1;i(a[1]+b[i],i)); } while(...
阅读全文
摘要:#include #include #include #include #include using namespace std; const int N=30010; int p[N],t,s[N],d[N],num[N],x,y; char c; int find(int x){ if(x==p[x])return x; int fx=find(p[x]); ...
阅读全文
摘要:#include #include #include using namespace std; char a[32]; int k,in[15],ans[1010]; bool d[15][15],vis[15]; void mul(int x){ for(int i=ans[0];i;i--){ ans[i]*=x; ans[i+1]+=ans[...
阅读全文
摘要:#include #include using namespace std; int n,a[100010],ans; int main(){ scanf("%d",&n); for(int i=1;ia[i-1])ans+=a[i]-a[i-1]; } printf("%d\n",ans); return 0; }
阅读全文
摘要:#include #include using namespace std; long long k,n,ans; int main(){ scanf("%lld%lld",&k,&n); long long x=1; while(n){ if(n&1)ans+=x; x*=k; n>>=1; } pr...
阅读全文
摘要:#include #include #include #include #include using namespace std; const int INF=1n){init(); dp(); return;} if(r-cnt==n-now){ q[cnt++]=now; dfs(now+1); q[cnt--]=0; ...
阅读全文
摘要:#include #include #include #include using namespace std; map m; int n,a[20]; string s[20]; int main(){ scanf("%d",&n); for(int i=1;i>s[i]; m[s[i]]=i; } for(int i=1;i>s1; ...
阅读全文
摘要:#include #include #include using namespace std; const int N=400020; const int M=200010; int p[N],n,m,k,a[M],sum,ans[M]; vector G[N]; bool b[N]; int find(int x){return x==p[x]?x:p[x]=find(p[x]);} ...
阅读全文
摘要:#include #include #include #include using namespace std; const int N=3020; int n,m; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; char a[N][N]; bool vis[N][N],vis2[N][N]; bool dfs(int x,int y){ ...
阅读全文
摘要:欧几里得算法:gcd(a,b)=gcd(b,a%b) 求 ax + by = c 的解 gcd(a,b)= c*n否则无解 对于ax+by=gcd(a,b) 当 b=0 时 gcd(a,b)=a 必有解x=1 y=0 假设ax1+by1=gcd(a,b) 根据扩展欧几里得 gcd(a,b)=gcd(
阅读全文
摘要:#include #include #include #include using namespace std; long long n,mod,a[2000010],t,cnt,y; int Max(int a,int b){ if(a>=b)return a; else return b; } inline void update(int l,int r,...
阅读全文
摘要:#include #include using namespace std; const int N=1000010; int n,m,mod; long long a[N],addv[N],mulv[N]; void pushdown(int o,int len){ if(mulv[o]!=1){ mulv[o*2]=mulv[o*2]*mulv[o]%mod; ...
阅读全文
摘要:#include #include using namespace std; const int N=1000010; int n,m; long long a[N],addv[N]; void pushdown(int o,int len){ if(addv[o]){ addv[o*2]+=addv[o]; addv[o*2+1]+=addv[o]...
阅读全文
摘要:#include #include using namespace std; int t,n,m; int getsg(int x,int y){ if(x%y==0)return 1; if(x/y==1)return 1-getsg(y,x%y); else return 1; } int main(){ scanf("%d",&t); whi...
阅读全文
摘要:#include #include using namespace std; int n,SG,T; int getSG(int x,int y){ int num=0; while(1){ if(x&1 && y&1)return num; if(x&1)x++; else if(y&1)y++; else ...
阅读全文
摘要:#include #include #include using namespace std; int n,a[30*2],sum,sum1,cnt=1; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){scanf("%d",&a[i]);} while(a[cnt]!=0){sum++; cnt++;} cnt=n; whi...
阅读全文
摘要:#include #include #include using namespace std; int n,m[510][510],ans; int main(){ scanf("%d",&n); for(int i=1;i<n;i++) for(int j=i+1;j<=n;j++){ int x; sca...
阅读全文
摘要://欧拉函数: 欧拉函数是积性函数——若m,n互质 特殊性质:当n为奇数时, 若n为质数则 #include <cstdio> #include <iostream> using namespace std; const int N=40010; int n,p[N],nop[N],cnt,phi[
阅读全文
摘要:#include #include #include using namespace std; int n,k,a[10010],t[1000010],dp[10010],maxn,cnt; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ int x; scanf("%d",&x); ...
阅读全文
摘要:#include #include using namespace std; int n,k; int main(){ scanf("%d%d",&n,&k); printf("%d\n",n/k); return 0; }
阅读全文
摘要://构造杨辉三角形 //使用二项式定理求答案
阅读全文
摘要:#include using namespace std; int n; long long ans=1; int main(){ scanf("%d",&n); for(register int i=1;i<=n;i++){ ans*=i; while(ans%10==0)ans/=10; ans%=100000000; ...
阅读全文
摘要:#include #include using namespace std; const int N=510; const int INF=10 && x10 && y1<=m && h[x1][y1]<h[x][y]){ if(!vis[x1][y1])dfs(x1,y1); p[x][y].l=min(p[x][y].l,p[x1][y1]...
阅读全文
摘要:#include #include #include using namespace std; const int N=70; int n,a[N],cnt,maxn,maxnn; bool cmp(int x,int y){return x>y;} bool use[N]; inline void dfs(int ans,int sum,int goal,int now){ i...
阅读全文
摘要:#include #include using namespace std; const int N=1000000; int p[N],n,m,nop[N],cnt,sum,ans[N]; int main(){ scanf("%d%d",&n,&m); nop[1]=1; for(int i=2;im){puts("Crossing the line"); co...
阅读全文
摘要:#include #include #include using namespace std; const int N=30; int n,s1[4][N],num[N]; char s[4][N]; bool vis[N]; void dfs(int x,int y,int t){ if(x==0){ if(t==0){ for(int ...
阅读全文

浙公网安备 33010602011771号