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

48 lines
892 B
C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
// #define int long long
// #define %d %ld
long long n, m, k;
long long gcd(long long a, long long b)
{
while (b != 0)
{
long long tmp = a;
a = b;
b = tmp % b;
}
return a;
}
int main()
{
// freopen("bout.txt","w",stdout);
scanf("%ld%ld%ld", &n, &m, &k);
// printf("%ld %ld %ld \n",n,m,k);
long long s = n * m / k * 2;
if ((n * m * 2 )% k != 0)//¶¼ÊÇint µÄ´í
{
// printf("%ld %ld %ld %ld \n",n,m,k,n * m * 2 % k);
printf("NO");
return 0;
}
long long n1 = gcd(k, n), m1 = gcd(k / n1, m);
long long n2 = n / n1, m2 = m / m1;
if (n2 * m2 / 2 * 2 == s) //*2ÒòΪ¿ªÊ¼Ê±s*=2;
{
printf("YES\n0 0\n%ld 0\n0 %ld", n2, m2);
}
else if (n2 * 2 <= n)
{
printf("YES\n0 0\n%ld 0\n0 %ld", n2 * 2, m2);
}
else
{
printf("YES\n0 0\n%ld 0\n0 %ld", n2, m2 * 2);
}
return 0;
}