TLE 求助
查看原帖
TLE 求助
734379
Shadow_T楼主2024/3/7 18:20
#include <bits/stdc++.h>
using namespace std;
map<int,int> mp;
int n,x;
int f()
{
	int y=x/n;
	x%=n;
	x*=10;
	return y;
}
int main()
{
	int t;
	cin>>t;
	for(int tot=1;tot<=t;tot++)
	{
		scanf("%d",&n);
		cout<<"0.";
		x=10;
		mp[x]=tot;
		while(x<n) x*=10,cout<<"0",mp[x]=tot;
		while(true)
		{
			printf("%d",f());
			if(mp[x]==tot) break;
			if(x==0) break;
			mp[x]=tot;
		}
		cout<<"\n";
	}
}
2024/3/7 18:20
加载中...