|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define uchar unsigned char
int main(void)
{
uchar a[1001];
long tek, K, i, j;
scanf("%ld", &K);
if (K < 10) {
printf("%ld 1\n", K);
return 0;
}
for (i = 1; i <= 9; i++) {
memset(&a, 0, sizeof(a));
a[i] = 1;
tek = i;
j = 2;
while (true) {
if (a[(tek * 10 + i) % K] != 0) {
break;
}
else {
a[(tek * 10 + i) % K] = 1;
tek = (tek * 10 + i) % K;
if (tek == 0) {
printf("%ld %ld\n", i, j);return 0;
}
}
j++;
}
}
printf("0 0\n");
return 0;
}
|
|