原题地址
#include <bits/stdc++.h>
#define PI acos(-1.0)
#define int long long
#define N 100001
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int a,b,h,l,n,q[N];
bool flag;
cin>>a>>b>>n;
l=a%b;
int t=0;
while(l!=0&&t<=3*n){
h=l*10/b;
l=l*10%b;
q[t]=h;
t++;
}
if(t<n){
cout<<-1;
return 0;
}for(int k=0;k<n;k++){
for(int i=1;i<=n-k;i++){
flag=true;
for(int j=0;j<i;j++)
if(q[k+j]!=q[k+j+i]) flag=false;
if(flag==true){
for(int j=k;j<i+k;j++) cout<<q[j];
return 0;
}
}
}
cout<<0;
return 0;
}
求大佬帮调80pts