ACM (TJU) : 1477


#include

int main ()
{
int dataSet;
scanf (“%d”, &dataSet);

while ( dataSet– ) {

int n;
int a [1000];
int i = 0;

scanf (“%d”, &n);

while ( n ) {
a [i++] = n % 2;
n /= 2;
}

bool flag = false;
for ( int index = 0; index < i; index++ ) { if ( a [index] == 1 ) { if ( flag ) printf (" "); flag = true; printf ("%d", index); } } printf ("\n"); } return 0; } [/sourcecode]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s