#include <stdio.h>
int main()
{
int x,s=1,n=1;
scanf("%d",&x);
while(s<x)
{
s=s*10+1;
n++;
}
while(1) {
printf("%d",s/x);
if(s%x==0) break;
s=(s%x)*10+1;
n++;
}
printf(" %d",n);
return 0;
}
代码来自:https://yunjinqi.top/article/167