daily pastebin goal
74%
SHARE
TWEET

Untitled

a guest Mar 21st, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,i,j,aux;
  8.     cin>>n;
  9.     int v[10001],o[10001];
  10.     for(i=1;i<=n;i++)
  11.         {cin>>v[i];
  12.         o[i]=i;}
  13.     for(i=1;i<n;i++)
  14.         for(j=i+1;j<=n;j++)
  15.     if(v[i]>v[j] )
  16.     { aux=v[i];
  17.     v[i]=v[j];
  18.     v[j]=aux;
  19.      aux=o[i];
  20.      o[i]=o[j];
  21.      o[j]=aux;
  22.     }
  23.     for(i=1;i<=n;i++)
  24.         cout<<o[i]<<" ";
  25.  
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top