Codeforces 1294C. Product of Three Numbers Solution
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE,23rd Batch
- ///Islamic University,Bangladesh
- #include<iostream>
- using namespace std;
- int main()
- {
- long long int n,ar[10],i,v=0,t;
- cin>>t;
- while(t--)
- {
- v=0;
- cin>>n;
- for(i=2; i*i<n&&v<2; i++)
- {
- if(n%i==0)
- {
- ar[v++]=i;
- n=n/i;
- }
- }
- if(v!=2)
- {
- cout<<"NO"<<endl;
- }
- else
- {
- cout<<"YES"<<endl;
- cout<<ar[0]<<" "<<ar[1]<<" "<<n<<endl;
- }
- }
- }
No comments