0031 - Weight

#include <iostream>
#include <vector>
using namespace std;

void Slove(int weight)	{
	vector<int> answer;

	answer.clear();
	for (int w=(2<<8); w>=1; w/=2)
		if (w <= weight)	{
			answer.push_back(w);
			weight-=w;
		}
	for (int i=answer.size()-1; i>=0; --i)	{
		cout << answer[i];
		(i != 0)? cout << " " : cout << endl;
	}
}

int main(void)	{
	int weight;

	while (cin >> weight)
		Slove(weight);
	return 0;
}

bit演算子を使ってみたかった。。