holiday/8.13/E-VasyaTriangle/E-VasyaTriangle.cpp

41 lines
559 B
C++
Raw Normal View History

2022-08-13 14:22:41 +08:00
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int n,m,k;
int gcd(int a,int b)
{
while(b!=0)
{
int tmp=a;
a=b;
b=tmp%b;
}
return a;
}
int main()
{
// freopen("bout.txt","w",stdout);
scanf("%d%d%d",&n,&m,&k);
int s=n*m/k*2;
if(n*m*2%k!=0)
{
printf("NO");
return 0;
}
int nm=gcd(n,m),n1=n/nm,m1=m/nm;
int x=gcd(k,n1),xy=gcd(k,nm),y=gcd(k,m1);
printf("%d %d %d %d\n",nm,x,y,xy);
if(gcd(x*y*xy,s)==s)
{
printf("YES\n0 0\n%d 0\n0 %d\n",x*xy,y);
}
else
{
printf("NO");
}
return 0;
}