#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
int k=0,i;
for(int j=1;j<=100000;j++){
if(a*10<b&&a!=0){
i=0;
a=a*10;
}
else{
a=a*10;
i=a/b;
a=a%b;
}
//cout<<a<<" "<<i<<endl;
if(i==c){
cout<<j<<endl;
return 0;
}
}
cout<<"-1"<<endl;
return 0;
}
本文介绍了一种通过模拟除法过程来寻找特定数字在分数小数表示中首次出现位置的方法。给定分数a/b和目标数字c,算法将确定c在小数点后的位置,并在未找到时返回-1。
.
You need to find the first occurrence of digit
.
The first zero stands on second position.
.
There is no digit
1325

被折叠的 条评论
为什么被折叠?



