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

Posted by hcj0923 at 2007-08-22 15:19:01 on Problem 1804
#include "stdio.h"
main()
{
	long i,j,n,m,a[2000],temp1,temp2,k,t;
	scanf("%ld",&n);
	for(i=0,k=0;k<n,i<n;k++,i++)
	{
		scanf("%ld",&m);
		temp1=0;
		temp2=0;
		for(j=0;j<m;j++)
			scanf("%ld",&a[j]);
		{
			for(t=0;t<m;t++)
				for(j=t+1;j<m;j++)
					if(a[t]<a[j])
						temp1++;
		}
		{
			for(t=0;t<m;t++)
				for(j=t+1;j<m;j++)
					if(a[t]>a[j])
						temp2++;
		}
		if(temp1<=temp2)			
			printf("Scenario #%ld:\n%ld\n\n",k+1,temp1);			
		else 
			printf("Scenario #%ld:\n%ld\n\n",k+1,temp2);
		
	}
}

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