#include<bits/stdc++.h>
using namespace std;
int calculation(int n)
{
int i, c = 0;
for(i=0; ; i++)
{
c = ((c*10) + 1)%n;
if(c == 0)
break;
}
return i+1;
}
int main()
{
int n;
while(cin >> n)
{
int x = calculation(n);
cout << x << endl;
}
return 0;
}
using namespace std;
int calculation(int n)
{
int i, c = 0;
for(i=0; ; i++)
{
c = ((c*10) + 1)%n;
if(c == 0)
break;
}
return i+1;
}
int main()
{
int n;
while(cin >> n)
{
int x = calculation(n);
cout << x << endl;
}
return 0;
}
Comments
Post a Comment