ACM (UVa) : 10127


#include <stdio.h>

int main () 
{
	long N, Input, One, K;

	while (scanf ("%ld", &Input) != EOF) {

		N = One = K = 1;

		while (K) {

			if ( N < Input ) {
				N = ( N * 10 ) + 1;
				One++;
			}

			K = N % Input;
			N = K;
		}

		printf("%ld\n", One);
	}

	return 0;
}
Advertisements

2 thoughts on “ACM (UVa) : 10127

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