ACM (TJU) : 1476


// http://acm.tju.edu.cn/toj/showp1476.html

#include <stdio.h>

int main ()
{
    int dataset;
    scanf ("%d", &dataset);

    while ( dataset-- ) {
        int n;
        scanf ("%d", &n);

        int power = 1;
        int p = 0;
        int o = 1;
        int count = 0;

        while ( power <= n ) {
            if ( n % power == 0 ) {
                p = count;
                o = n / power;
            }

            power *= 2;
            count++;
        }

        printf ("%d %d\n", o, p);

    }

    return 0;
}
Advertisements

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