#include "iostream"
#include "cstdio"
using namespace std;
int main()
{
int n, cnt, ans;
while (scanf("%d", &n) != EOF)
{
ans = 1;
cnt = 1;
while (1)
{
if (ans % n == 0) break;
else
ans = (ans % n * 10) + 1;//就好似我们的除法一样,当除不尽的时候,只是取余数进行运算就可以!这个处理很重要,要不会超时!
cnt++;
}
cout << cnt << endl;
}
system("pause");
}
poj 2551 Ones
最新推荐文章于 2020-03-29 11:46:54 发布