为什么不能用双循环遍历的方式找出大的质因数
查看原帖
为什么不能用双循环遍历的方式找出大的质因数
588744
ww_newhand楼主2021/10/25 21:14
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;

	for (int i = 2;; i++)
	{
		for (int j = 3;; j++)
		{
			if ((i*j == n) && (i*j < 2e10))
			{
				if (j > i)
					cout << j << endl;
				else
					cout << i << endl;
			}
			else
				return 0;
		}
	}
	system("pause");
	return 0;
}
2021/10/25 21:14
加载中...