-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1294C.cpp
97 lines (85 loc) · 2.16 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <bits/stdc++.h>
using namespace std;
/**----data type----*/
#define ll long long int
#define llu unsigned long long int
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define nl '\n'
/**-------Shortend Library-------*/
#define vi vector<int>
#define mii map<int, int>
#define f(i,n) for(ll i=0; i<n; i++)
#define FOR(i, a, b) for(ll i=a; i<=b; i++)
#define testcase ll t;cin>>t;while(t--)
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define Sort(x) sort(x.begin(),x.end())
#define SortR(x) sort(x.begin(),x.end(),greater<int>())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)
#define mid(l,r) (l+(r-l)/2)
#define leftShift(p) (p<<1)
#define rightShift(p) (p>>1)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define pb(x) push_back(x)
#define mod 1e8+7
#define precision(x) cout<<fixed<<setprecision(x)
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
/**----Functions to use----**/
ll powerLog(ll base, ll power)
{
ll res = 1;
while(power)
{
if(power%2)
{
res *= base;
power--;
} else
{
base *=base;
power/=2;
}
}
return res;
}
void cholokori()
{
ll n;
cin>>n;
int temp = n, mul=1;
vi ans;
for(int i=2; i*i<=n; i++) {
if(n%i==0) {
ans.pb(i);
n/=i;
mul*=i;
}
if(ans.size()==2) break;
}
if(ans.size()<2 || temp/mul==ans[0] || temp/mul==ans[1] || temp/mul==1) no;
else {
yes;
for(int i=0; i<2; i++) {
cout<<ans[i]<<" ";
}
cout<<temp/mul<<nl;
}
}
int main()
{
testcase{
cholokori();
}
return 0;
}