Pabon_SEC

Ones

Mar 4th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,i,j;
  8.  
  9.     while(scanf("%d",&n)==1)
  10.     {
  11.         i = j = 1;
  12.  
  13.         while(i>0)
  14.         {
  15.             i = (i*10+1)%n;
  16.             j++;
  17.         }
  18.  
  19.         printf("%d\n",j);
  20.     }
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment