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 |
各位大哥,可不可以帮我看一下我这个程序错在哪里?老是出现wrong answer,但我觉得没错呀!#include<iostream> using namespace std; int main() { int m,n; cin>>m>>n; if(m<=0||m>50||n<=0||n>100) exit(0); char *a=new char[m*n+2]; int *b=new int[n+1]; for(int c=1;c<n+1;c++) b[c]=0; for(int i=1;i<m*n+1;i++) {cin>>a[i]; if(a[i]!='A'&&a[i]!='C'&&a[i]!='G'&&a[i]!='T') exit(0); }a[m*n+1]='\0'; for(int k=1;k<n+1;k++) { int s=m*(k-1)+1; for( ;s<m*k+1;s++) {int t=s+1; for( ;t<m*k+1;t++) {if(a[s]>a[t]) b[k]++;} } } int *q=new int[n+1]; for(int d=1;d<n+1;d++) q[d]=0; for(int h=1;h<n+1;h++) {int temp=b[h];int l; q[h]=h; for(int j=1;j<n+1;j++) { if(temp>b[j]) {temp=b[j];l=j;q[h]=j;} } b[l]=1000; } for(int i=1;i<n;i++) {for(int s=m*(q[i]-1)+1;s<m*q[i]+1;s++) { cout<<a[s];} cout<<endl; } for(int s=m*(q[n]-1)+1;s<m*q[n]+1;s++) cout<<a[s]; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator