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 |
没地方保存,先借地方用一下#include<stdio.h> main() { int t,n,a[20],b[10000],temp,i,j,k,u=0; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d",&a[i]); for(j=0;j<a[i];j++)scanf("%d",&b[j]); } for(i=0;i<t;i++) {for(k=0;k<a[i];k++) {for(j=i+1;j<a[i];j++) if(a[j]==k+1) {temp=b[i]; b[i]=a[j]; b[j]=temp; u++;break;} for(i=0;i<n;i++)if(b[i]==k+1)break;} printf("%d\n",u); }} Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator