标签:
1 #include<iostream>
2 using namespace std;
3
4 int main(){
5 int N = 0; int M = 0;
6 while(scanf("%d %d",&N,&M) == 2){
7 int numTemp = 0; int count = 1;
8 numTemp = N;
9 while(!(numTemp % M == 0) && count <= M){
10 numTemp = 10 * (numTemp % M) + N; /*由于numTemp是以指数阶增加的,防止numTemp越界错误*/
11 count++;
12 }
13 if(count == M+1){
14 printf("0\n");
15 }else{
16 printf("%d\n",count);
17 }
18 }
19 return 0;
20 }
标签:
原文地址:http://www.cnblogs.com/grey-qisen/p/4743541.html