求各位大佬帮忙看看,这个TLE了,怎么办?
查看原帖
求各位大佬帮忙看看,这个TLE了,怎么办?
312292
Linda061123楼主2020/7/20 10:51
#include<bits/stdc++.h> 
using namespace std;
int n;
int main()
{
	cin >> n;
	for(int i = 2;i <= n;i++)
	{
		for(int j = 2;j <= sqrt(n);j++)
		{
			if(i % j == 0 && i != j)
			continue;
			else if(n % i == 0)
			{
				cout << n / i;
				return 0;
			}
		}
	}
	return 0;
}
2020/7/20 10:51
加载中...