Guest User

Untitled

a guest
Feb 24th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. int n;cin>>n;
  2. vector<int> v(n);
  3. for(int &i:v)cin>>i;
  4. sort(v.begin(),v.end());
  5.  
  6. for(int i=0;i<n;i++){
  7.     int kk=v[i];//kk==v[i]
  8.     for(int j=0;j<n;j++)v[j]-=kk;//<---different output if i replace 'kk' with 'v[i]'
  9.     for(int asd:v)cout<<asd<<" ";cout<<"\n";
  10. }
  11. //the output is different for 'kk' and 'v[i]', why??
Add Comment
Please, Sign In to add comment