Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- void main()
- {
- int a, b[1000], d;
- bool used[1000];
- cin >> a;
- d=a;
- for(int i=0;i<a;i++)
- {
- cin >> b[i];
- }
- for(int j=0;j<a;j++)
- {
- while(used[d-b[j]]==true)
- b[j]++;
- cout << d-b[j] << " ";
- used[d-b[j]]=true;
- if(b[j]==0)
- --d;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement