OnesTime Limit: 1000MS Memory Limit: 65536K
Total Submissions: 10306 Accepted: 5869DescriptionGiven any integer 0 <= n <= 10000 not divisible by 2 or 5, some multiple of n is a number which in decimal notation is a sequence of 1's. How many digits are in the smallest such a multiple of n? InputEach line contains a number n.OutputOutput the number of digits.Sample Input3 7 9901Sample Output3612SourceWaterloo local 2001.06.02//136K 16MS C++ 273B//题意:求最少个连续的1 mod n为0 //思路:设i个1 %n 余数为 e,i+1个1 为(e*10+1)%n // 当e为0时得到最少个1的数量 #includeint main(void){ int n; while(scanf("%d",&n)!=EOF) { int e=1; int cnt=1; while(e!=0){ e=10*e+1; e%=n; cnt++; } printf("%d\n",cnt); } return 0;}