Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么总是wrong answer

Posted by fanrongqi at 2011-01-05 13:58:54 on Problem 1007


#include <iostream>

using namespace std;
int main()
{
	char str[101][51];//={{'A','A','C','A','T','G','A','A','G','G'},
// 	{'T','T','T','T','G','G','C','C','A','A'},
// 	{'T','T','T','G','G','C','C','A','A','A'},
// 	{'G','A','T','C','A','G','A','T','T','T'},
// 	{'C','C','C','G','G','G','G','G','G','A'},
// 	{'A','T','C','G','A','T','G','C','A','T'}
// 	};
	char tstr[51];
	char* p=NULL;
    int n,m;
	int i,j,k;
	int y=0;
	int score[101];
    int temp;
	int max=0;
	cin>>m>>n;//先输入的长度。后字符串个数

        for (i=0;i<n;i++)
      {
  		cin>>tstr;
  		p=&tstr[0];
  		for (j=0;j<50;j++)
  		{
 			if (j<m)
 			{str[i][j]=(*p);
 			p++;
 			} 
 			else
 			{
 				str[i][j]='0';
 			}
  			
  		}
      }
     p=NULL;
	for (i=0;i<n;i++)
	{
		temp=0;
		j=0;
		while(j<m)
		{
			if (str[i][j]=='A')
			{
				j++;
				continue;
			}
			k=j+1;
			while(k<m)
			{
				if (str[i][j]>str[i][k])
				{	temp++;	}
				k++;
			}
			j++;
		}
		if (max<temp)
		{
			max=temp;
		}
		score[y]=temp;
		y++;
	}

	for (j=0;j<=max;j++)
	{
		for (k=0;k<n;k++)
		{
			if (score[k]==j)
			{
				cout<<str[k]<<endl;
			}
		}
	}
	return 0;
}




Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator