#include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <vector> #include <string> #include <sstream> #include <algorithm> #include <map> #include <bitset> #define MAX 1000000 using namespace std; typedef long long int lli; int main(int argc, char *argv[]){ int n; while (cin >> n){ int digit=1, number=1; for (int number=1; number%n!=0; number=number*10+1, number%=n) digit++; cout << digit << endl ; } return 0; }
沒有留言:
張貼留言