Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n;cin>>n;
- vector<int> v(n);
- for(int &i:v)cin>>i;
- sort(v.begin(),v.end());
- for(int i=0;i<n;i++){
- int kk=v[i];//kk==v[i]
- for(int j=0;j<n;j++)v[j]-=kk;//<---different output if i replace 'kk' with 'v[i]'
- for(int asd:v)cout<<asd<<" ";cout<<"\n";
- }
- //the output is different for 'kk' and 'v[i]', why??
Add Comment
Please, Sign In to add comment