#include <stdio.h>
int count(int x) {
int temp = 1, counter = 1;
while (temp % x != 0) {
temp = (temp * 10 + 1) % x;
counter++;
}
return counter;
}
int main()
{
int x;
while(scanf("%d",&x)==1){
printf("%d\n",count(x));
}
return 0;
}
int count(int x) {
int temp = 1, counter = 1;
while (temp % x != 0) {
temp = (temp * 10 + 1) % x;
counter++;
}
return counter;
}
int main()
{
int x;
while(scanf("%d",&x)==1){
printf("%d\n",count(x));
}
return 0;
}
No comments:
Post a Comment