Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. void main()
  6. {
  7. int a, b[1000], d;
  8. bool used[1000];
  9. cin >> a;
  10. d=a;
  11. for(int i=0;i<a;i++)
  12. {
  13. cin >> b[i];
  14. }
  15. for(int j=0;j<a;j++)
  16. {
  17. while(used[d-b[j]]==true)
  18. b[j]++;
  19. cout << d-b[j] << " ";
  20. used[d-b[j]]=true;
  21. if(b[j]==0)
  22. --d;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement