Advertisement
Tahmidimtiazimu

pro

Jan 25th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4. int N,a[1000];
  5.  
  6. while(scanf("%d",&N)==1){
  7. for(int i = 0;i<N;++i) scanf("%d",&a[i]);
  8.  
  9. int ans = 0;
  10.  
  11. for(int i = 1;i<N;++i)
  12. for(int j = 0;j<i;++j)
  13. if(a[j]>a[i])
  14. ++ans;
  15.  
  16. printf("Minimum exchange operations : %d\n",ans);
  17. }
  18.  
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement