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

帮我看看为什么会WA~~~我是在找不出错误了@@@@@@@谢了[我是用__int64排序做的]

Posted by Elysium at 2006-08-12 14:35:04 on Problem 2945
#include <iostream>
#include <cstring>
#include <algorithm>

char str[24];
int label[20000],len;
__int64 rate[20];
__int64 a[20004];

int main(void)
{
	int i,j,k,n,m;

	for(rate[0]=1,i=1;i<20;++i)
		rate[i]=rate[i-1]<<2;
	while(1)
	{
		scanf("%d %d\n",&n,&m);
		if(0==n&&0==m)break;
		len=0;
		memset(a,0,n*sizeof(__int64));
		memset(label,0,n*sizeof(int));
		while(n--)
		{
			gets(str);
			for(i=0;i<m;++i)
			{
				switch(str[i])
				{
					case 'C':a[len]+=rate[i];break;
					case 'G':a[len]+=rate[i]<<1;break;
					case 'T':a[len]+=3*rate[i];
				}
			}
			++len;
		}
		std::sort(a,a+len);
		for(a[len]=-1,k=a[0],j=0,i=1;i<=len;++i)
		{
			if(a[i]==k)
				++j;
			else
			{
				++label[j];
				k=a[i];
				j=0;
			}
		}
		for(i=0;i<len;++i)
			printf("%d\n",label[i]);
	}

	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