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

48 lines
892 B
C++
Raw Normal View History

2022-08-15 08:28:33 +08:00
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
2022-08-13 14:22:41 +08:00
using namespace std;
2022-08-15 10:35:14 +08:00
// #define int long long
// #define %d %ld
long long n, m, k;
long long gcd(long long a, long long b)
2022-08-13 14:22:41 +08:00
{
2022-08-15 08:28:33 +08:00
while (b != 0)
2022-08-13 14:22:41 +08:00
{
2022-08-15 10:35:14 +08:00
long long tmp = a;
2022-08-15 08:28:33 +08:00
a = b;
b = tmp % b;
2022-08-13 14:22:41 +08:00
}
return a;
}
int main()
{
2022-08-15 08:28:33 +08:00
// freopen("bout.txt","w",stdout);
2022-08-15 10:35:14 +08:00
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)//<2F><><EFBFBD><EFBFBD>int <20>Ĵ<EFBFBD>
2022-08-13 14:22:41 +08:00
{
2022-08-15 10:35:14 +08:00
// printf("%ld %ld %ld %ld \n",n,m,k,n * m * 2 % k);
printf("NO");
2022-08-13 14:22:41 +08:00
return 0;
}
2022-08-15 10:35:14 +08:00
long long n1 = gcd(k, n), m1 = gcd(k / n1, m);
long long n2 = n / n1, m2 = m / m1;
2022-08-15 08:28:33 +08:00
if (n2 * m2 / 2 * 2 == s) //*2<><32>Ϊ<EFBFBD><CEAA>ʼʱs*=2;
2022-08-13 14:22:41 +08:00
{
2022-08-15 10:35:14 +08:00
printf("YES\n0 0\n%ld 0\n0 %ld", n2, m2);
2022-08-15 08:28:33 +08:00
}
else if (n2 * 2 <= n)
{
2022-08-15 10:35:14 +08:00
printf("YES\n0 0\n%ld 0\n0 %ld", n2 * 2, m2);
2022-08-13 14:22:41 +08:00
}
else
{
2022-08-15 10:35:14 +08:00
printf("YES\n0 0\n%ld 0\n0 %ld", n2, m2 * 2);
2022-08-13 14:22:41 +08:00
}
return 0;
2022-08-15 08:28:33 +08:00
}