Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
麻烦帮我看一下,谢谢。In Reply To:检查你程序的其他地方是否有数组访问越界 Posted by:xfxyjwf at 2007-12-24 13:33:48 麻烦帮我一起看,谢谢。 #include <iostream> using namespace std; int record[21][21][21][21]; int A,T,C,G; int c[20001]; char in[20]; int n,m; int temp; int makevalue() { A=T=C=G=0; int i=0; while(i<m) { switch(in[i]) { case 'A':A++;break; case 'T':T++;break; case 'C':C++;break; case 'G':G++;break; default:break; } i++; } } int main() { while(scanf("%d %d",&n,&m),n!=0||m!=0) { memset(record,0,sizeof(record)); memset(c,0,sizeof(c)); for(int i=1;i<=n;i++) { scanf("%s",in); makevalue(); temp=++record[A][T][C][G]; c[temp-1]++; if(temp>1)c[temp-2]--; } for(int i=0;i<n;i++) printf("%d\n",c[i]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator