#include <iostream>
#include <map>
using namespace std;int main(){
map<int,bool> m;
int a,b;
cin >> a >> b;
a=a%b;
while(!m[a]){
m[a]=true;
a=(a*10)%b;
}
cout << m.size();
system("pause");
return 0;
}
#include <map>
using namespace std;int main(){
map<int,bool> m;
int a,b;
cin >> a >> b;
a=a%b;
while(!m[a]){
m[a]=true;
a=(a*10)%b;
}
cout << m.size();
system("pause");
return 0;
}
/*
注意用不是用商判斷,用餘數判斷 14143 99999 => 5
1 7 => 7
1231234 9999999 => 7
注意用不是用商判斷,用餘數判斷 14143 99999 => 5
1 7 => 7
1231234 9999999 => 7
Excel
=QUOTIENT(B2,99999)
=MOD(B2,99999)
*/
沒有留言:
張貼留言