-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1294c.cpp
49 lines (46 loc) · 888 Bytes
/
1294c.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "bits/stdc++.h"
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
set<int> div;
for(int i=2; i*i<=n; i++)
{
if(n%i==0 && div.count(i)==0)
{
div.insert(i);
n /=i;
break;
}
}
for(int i=2; i*i<=n; i++)
{
if(n%i==0 && div.count(i)==0)
{
div.insert(i);
n /=i;
break;
}
}
if(div.size()<2 || div.count(n) || n==1)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
div.insert(n);
for(auto i:div)
{
cout<<i<<" ";
}
puts("");
}
}
return 0;
}