#include<stdio.h>
int main()
{
int i, j, k = 0, temp, n,anik[1000];
while(scanf("%d", &n) != EOF)
{
k = 0;
for(i=0; i<n; i++)
{
scanf("%d", &anik[i]);
}
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if(anik[i]>anik[j])
{
k++;
}
}
}
printf("Minimum exchange operations : %d\n", k);
}
return 0;
}
int main()
{
int i, j, k = 0, temp, n,anik[1000];
while(scanf("%d", &n) != EOF)
{
k = 0;
for(i=0; i<n; i++)
{
scanf("%d", &anik[i]);
}
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if(anik[i]>anik[j])
{
k++;
}
}
}
printf("Minimum exchange operations : %d\n", k);
}
return 0;
}
Comments
Post a Comment