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 yycf114 at 2005-01-02 03:10:55 on Problem 1674
#include <stdio.h>
void main()
{
	int m ,n,i,j,a[1000],b[22],t,s=0;
	scanf("%d",&m);
	if(m>=1&&m<=20){
	 for(t=0;t<m;t++){
		scanf("%d\n",&n);
		for(i=0;i<n;i++)
			scanf("%d",&a[i]);
	    for(j=1;j<=n;j++){
					for(i=j;i<n;i++){
						if(a[i]==j){
							a[i]=a[j-1];
							a[j-1]=j;
					        s+=1;	
						}
					}
			}
	   for(i=0;i<n;i++)
		 a[i]=0;
	   b[t]=s;s=0;
	 }
	for(t=0;t<m;t++)
	printf("%d\n",b[t]);
	}
}

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