| ||||||||||
| 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 | |||||||||
Re:怎么wrong answer?高手帮忙看一下啊In Reply To:怎么wrong answer?高手帮忙看一下啊 Posted by:yycf114 at 2005-01-02 03:10:55 > #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;
~~~~~~~~在这加break;
> }
> }
> }
> 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator