C. Product of Three Numbers1300 / 简单数论

Posted 幽殇默

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C. Product of Three Numbers1300 / 简单数论相关的知识,希望对你有一定的参考价值。


https://codeforces.com/problemset/problem/1294/C

#include<bits/stdc++.h>
using namespace std;
int main(void) 
{
	int t; cin>>t;
	while(t--)
	{
		int n; cin>>n;
		bool flag=0;
		for(int i=2;i<=n/i;i++)
		{
			if(n%i==0)
			{
				int temp=n/i;
				for(int j=2;j<=temp/j;j++) 
				{
					if(temp%j==0)
					{
						int a=i,b=j,c=temp/j;
						if(a==b||a==c||b==c) continue;
						puts("YES");
						cout<<j<<" "<<temp/j<<" "<<i<<endl;
						flag=1;
						break;
					}
				}
			}
			if(flag) break;
		}
		if(!flag) puts("NO");
	}
	return 0;
}

以上是关于C. Product of Three Numbers1300 / 简单数论的主要内容,如果未能解决你的问题,请参考以下文章

628. Maximum Product of Three Numbers@python

628. Maximum Product of Three Numbers

628. Maximum Product of Three Numbers

628. Maximum Product of Three Numbers

628. Maximum Product of Three Numbers

[leetcode] Maximum Product of Three Numbers