#include<iostream>
#include<vector>
#include<algorithm>
 
int main()
{
    const int weight[] = {1,2,4,8,16,32,64,128,256,512};
 
    std::vector<int> answer;
 
    int n;
 
    while(std::cin >> n)
    {
        for(size_t i=0; i<10; ++i)
        {
            if(n/weight[9-i])
            {
 
                answer.push_back(weight[9-i]);
 
                n = n%weight[9-i];
            }
        }
 
        for(size_t i=0; i<answer.size()-1; ++i)
        {
            std::cout << answer[answer.size()-1-i] << ' ';
        }
 
        std::cout << answer[0] << '\n';
 
        answer.clear();
    }
 
}
Compile Error Logs:

Status
Judge: 1/1 	C++ 	CPU: 00.00 sec 	Memory: 1212 [KB] 	Length: 476 [B] 	2012-08-29 02:02 	2012-08-29 02:02
Results for testcases
							
Case #1: 	: Accepted 	- 	- 	- 	NA 	- 	NA
< | 	1 	/ 	1 	| > 	  	 : Accepted        -        -
 
Input #1 ( ) 		Output #1 ( )

Not available.

		

Not available.

Comments
 
 Under Construction.
 
Categories
 
 
Free Tags
 
 