Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char cur[1044] = {0};
- int main(){
- int n,rd,i;
- while(~scanf("%d",&rd)){
- cur[rd]++;
- for(i = rd;i <= 1024;i++){
- if(cur[i] > 1){
- cur[i] &= 1;
- cur[i + 1]++;
- }
- }
- for(i = 1024;i >= 0;i--){
- if(cur[i]){
- printf("%d\n",i);
- break;
- }
- }
- }
- for(i = 1024;i >= 0;i--){
- if(cur[i]){
- printf("%d ",i);
- }
- }
- putchar('\n');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement