~cpp // no10127 - Ones #include <iostream> using namespace std; void main() { int n, temp, reminder, i, j; while (cin >> n) { reminder = 0; for (i=0; ;i++) { temp = 1; for (j=0; j<i; j++) { temp *= 10; if (temp >= n) temp %= n; } reminder += temp; if (reminder % n == 0) break; } cout << i+1 << endl; } }