#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
int a,b[1000],c,m,d,e;
while(cin>>a){
for(int x=0;x<a;x++){
cin>>b[x];
}
m=0;
while(1){
e=m;
for(c=0;c<a-1;c++){
if(b[c+1]<b[c]){
d=b[c+1];
b[c+1]=b[c];
b[c]=d;
m++;
}
}
if(m==e){
cout<<"Minimum exchange operations : "<<m<<endl;
break;
}
}
}
system("pause");
return 0;
}
沒有留言:
張貼留言