标签:重复 ima script code getc color sub blog mst
N<= 20
1 #include <cstdlib> 2 #include <cstdio> 3 4 inline void read(int &x) 5 { 6 x=0; register char ch=getchar(); 7 for(; ch>‘9‘||ch<‘0‘; ) ch=getchar(); 8 for(; ch>=‘0‘&&ch<=‘9‘; ch=getchar()) x=x*10+ch-‘0‘; 9 } 10 const int N(110); 11 int n,len,cnt,pos[N],ii[N],vis[N*1000]; 12 13 int Presist() 14 { 15 // freopen("A.in","r",stdin); 16 // freopen("A.out","w",stdout); 17 18 read(n); pos[1]=0; vis[0]=1; 19 for(int i=1; i<=n; ++i) 20 { 21 read(ii[i]),len+=ii[i]; 22 pos[i+1]=pos[i]+ii[i]; 23 vis[pos[i+1]]=i+1; 24 } len>>=1; 25 for(int i=1; i<=n&&pos[i]<=len; ++i) 26 if(vis[pos[i]+len]<=n&&vis[pos[i]+len]) ++cnt; 27 printf("%d",cnt*(cnt-1)/2); 28 return 0; 29 } 30 31 int Aptal=Presist(); 32 int main(){;}
BZOJ——T 1800: [Ahoi2009]fly 飞行棋
标签:重复 ima script code getc color sub blog mst
原文地址:http://www.cnblogs.com/Shy-key/p/7567702.html