fork(1) download
  1. #include <bits/stdc++.h>
  2. #define ll long long int
  3. using namespace std;
  4. int div(int n){
  5. int c=1,temp=7;
  6. while(temp%n!=0){
  7. temp=(temp%n)*10+7;
  8. c++;
  9. }
  10. return c;
  11. }
  12. int main()
  13. {
  14. int n;
  15. cin>>n;
  16. if(n%2==0 || n%5==0){
  17. cout<<-1;
  18. return 0;
  19. }
  20. cout<<div(n);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 4276KB
stdin
999983
stdout
999982