40分求助
查看原帖
40分求助
737939
AFO_wyx楼主2022/11/13 10:02

rt,前两个AC,后两个TLE

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,n,i,t;
	string s;
	scanf("%d%d%d",&a,&b,&n);
	t=a%b;
	for(i=1;i<=n+4;++i){
		t*=10;
		s=s+to_string(t/b);
		t%=b;
	}for(i=n-1;i<n+2;++i)printf("%c",s[i]);
	return 0;
}
2022/11/13 10:02
加载中...