1000#includestdio.hintmain(){inta,b,c;while(scanf(%d%d,&a,&b)!=EOF){c=a+b;printf(%d\n,c);}}1067#includestdio.h#includemath.h#includestdlib.hintmain(){inta,b;while(scanf(%d%d,&a,&b)!=EOF){if(ab){intt=a;a=b;b=t;}intk=b-a;inta0=(int)(k*(1+sqrt(5.0))/2);if(a0==a)printf(0\n);elseprintf(1\n);}}1080#includestdio.h#includestdlib.hinta[5][5]={5,-1,-2,-1,-3,-1,5,-3,-2,-4,-2,-3,5,-2,-2,-1,-2,-2,5,-1,-3,-4,-2,-1,0};intmain(){intca;scanf(%d,&ca);while(ca--){intn,m,i,j,max[105][105],b[105],d[105];chars[105],c[105];scanf(%d%s,&n,s);scanf(%d%s,&m,c);for(i=1;i=n;i++){if(s[i-1]=='A')b[i]=0;if(s[i-1]=='C')b[i]=1;if(s[i-1]=='G')b[i]=2;if(s[i-1]=='T')b[i]=3;}for(i=1;i=m;i++){if(c[i-1]=='A')d[i]=0;if(c[i-1]=='C')d[i]=1;if(c[i-1]=='G')d[i]=2;if(c[i-1]=='T')d[i]=3;}max[0][0]=0;for(i=1;i=n;i++)max[i][0]=max[i-1][0]+a[b[i]][4];for(i=1;i=m;i++)max[0][i]=max[0][i-1]+a[4][d[i]];for(i=1;i=n;i++)for(j=1;j=m;j++){max[i][j]=max[i-1][j-1]+a[b[i]][d[j]];if(max[i-1][j]+a[b[i]][4]max[i][j])max[i][j]=max[i-1][j]+a[b[i]][4];if(max[i][j-1]+a[4][d[j]]max[i][j])max[i][j]=max[i][j-1]+a[4][d[j]];}printf(%d\n,max[n][m]);}}1013#includestdio.h#includealgorithm#includemath.h#includestdlib.h#definePI3.141592653usingnamespacestd;structpoint{doublex;doubley;}p[30005],res[30005];intcmp(pointp1,pointp2){returnp1.yp2.y||(p1.y==p2.y&&p1.xp2.x);}boolral(pointp1,pointp2,pointp3){if((p2.x-p1.x)*(p3.y-p1.y)=(p2.y-p1.y)*(p3.x-p1.x))returntrue;returnfalse;}doubledis(pointp1,pointp2){returnsqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));}intmain(){intn,m;while(scanf(%d%d,&n,&m)!=EOF){inti,j;for(i=0;in;i++)scanf(%lf%lf,&p[i].x,&p[i].y);sort(p,p+n,cmp);res[0]=p[0];res[1]=p[1];inttop=1;for(i=2;in;i++){while(top&&ral(res[top-1],res[top],p[i]))top--;res[++top]=p[i];}intlen=top;res[++top]=p[n-2];for(i=n-3;i=0;i--){while(top!=len&&ral(res[top-1],res[top],p[i]))top--;res[++top]=p[i];}doublet=0;for(i=0;itop;i++)t=t+dis(res[i],res[i+1]);printf(%.lf\n,t+2*PI*m);}}1149#includeiostream#includecstringusingnamespacestd;#defineinf0x5fffffffinta[105][105],f[1005],ct[1005],pre[205],n,m,q[105];intbfs(){intflow=inf,qh=0,qe=1,i;memset(pre,-1,sizeof(pre));q[1]=0;pre[0]=-1;while(qhqe){intt=q[++qh];for(i=1;i=n+1;i++)if(pre[i]==-1&&a[t][i]0){pre[i]=t;if(a[t][i]flow)flow=a[t][i];if(i==n+1)returnflow;q[++qe]=i;}}return-1;}voidmaxflow(){intres=0,ans,t;while((ans=bfs())!=-1){res=res+ans;t=n+1;while(t){a[pre[t]][t]-=ans;a[t][pre[t]]+=ans;t=pre[t];}}printf(%d\n,res);}intmain(){while(scanf(%d%d,&m,&n)!=EOF){memset(f,-1,sizeof(f));memset(a,0,sizeof(a));inti,j,k,t;for(i=1;i=m;i++)scanf(%d,&ct[i]);for(i=1;i=n;i++){scanf(%d,&k);for(j=1;j=k;j++){scanf(%d,&t);if(f[t]!=-1)a[f[t]][i]=inf;elsea[0][i]=a[0][i]+ct[t];f[t]=i;}scanf(%d,&k);a[i][n+1]=k;}maxflow();}}1157#includestdio.h#includestdlib.hinta[105][105],b[105][105];intmain(){intmax(intx,inty);intn,m;while(scanf(%d%d,&n,&m)!=EOF){inti,j;for(i=1;i=n;i++)for(j=1;j=m;j++)scanf(%d,&a[i][j]);b[1][1]=a[1][1];for(i=2;i=m-n+1;i++){if(a[1][i]b[1][i-1])b[1][i]=b[1][i-1];elseb[1][i]=a[1][i];}for(i=2;i=n;i++)for(j=i;j=i+m-n;j++){a[i][j]=a[i][j]+b[i-1][j-1];if(i==j)b[i][j]=a[i][j];else{if(a[i][j]b[i][j-1])b[i][j]=a[i][j];elseb[i][j]=b[i][j-1];}}printf(%d\n,b[n][m]);}}1200#includestdio.h#includestring.hboolflag[20000000];inta[300];chars[20000000];intmain(){intn,m;while(scanf(%d%d,&n,&m)!=EOF){memset(flag,0,sizeof(flag));scanf(%s,s);inti,j=0,len=strlen(s);memset(a,0,sizeof(a));for(i=0;ilen;i++)a[s[i]]=1;for(i=0;i256;i++)if(a[i]==1)a[i]=j++;intmod=1,res=0;for(i=0;in-1;i++)mod=mod*m;for(i=0;in;i++)res=res*m+a[s[i]];flag[res]=1;for(i=n;ilen;i++){res=res%mod*m+a[s[i]];flag[res]=1;}intcount=0;mod=mod*m;for(i=0;i=mod;i++)if(flag[i]==1)count++;printf(%d\n,count);}}1207#includestdio.h#includestdlib.hintmain(){intb,c,i,j,max=0,k,t,r;while(scanf(%d%d,&b,&c)!=EOF){if(bc){t=b;r=c;}else{t=c;r=b;}max=0;for(i=r;i=t;i++){j=1;k=i;while(k!=1){j++;if(k%2==0)k=k/2;elsek=3*k+1;}if(jmax)max=j;}printf(%d%d%d\n,b,c,max);}//system(pause);}1273#includeiostream#includecstring#includequeueusingnamespacestd;#defineinfINT_MAXintn,m,a[205][205],pre[205],lev[205],num[205];voidbfs(){queueintQ;memset(lev,-1,sizeof(lev));memset(num,0,sizeof(num));Q.push(n);lev[n]=0;num[0]=1;while(!Q.empty()){intt=Q.front(),i;Q.pop();for(i=1;i=n;i++)if(lev[i]==-1&&a[i][t]0){lev[i]=lev[t]+1;num[lev[i]]++;Q.push(i);}}}intmaxflow(){intflow=0,i,ans,cur=1;bfs();while(lev[cur]n){if(cur==n){ans=inf;while(cur!=1){if(a[pre[cur]][cur]ans)ans=a[pre[cur]][cur];cur=pre[cur];}cur=n;while(cur!=1){a[pre[cur]][cur]-=ans;a[cur][pre[cur]]+=ans;cur=pre[cur];}flow=flow+ans;}for(i=1;i=n;i++)if(a[cur][i]0&&lev[cur]==lev[i]+1){pre[i]=cur;cur=i;break;}if(in){lev[cur]=n+1;num[lev[cur]]--;if(num[lev[cur]]==0)break;for(i=1;i=n;i++)if(a[cur][i]0&&lev[i]+1lev[cur])lev[cur]=lev[i]+1;num[lev[cur]]++;if(cur!=1)cur=pre[cur];}}returnflow;}intmain(){while(scanf(%d%d,&m,&n)!=EOF){inti,j;memset(a,0,sizeof(a));for(i=0;im;i++){intb,c,d;scanf(%d%d%d,&b,&c,&d);a[b