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

46 lines
764 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 08:28:33 +08:00
int n, m, k;
int gcd(int a, int 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 08:28:33 +08:00
int tmp = a;
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);
scanf("%d%d%d", &n, &m, &k);
printf("%d %d %d \n",n,m,k);
int s = n * m / k * 2;
if (n * m * 2 % k != 0)
2022-08-13 14:22:41 +08:00
{
2022-08-15 08:28:33 +08:00
printf("%d %d %d %d \n",n,m,k,n * m * 2 % k);
printf("\\NO");
2022-08-13 14:22:41 +08:00
return 0;
}
2022-08-15 08:28:33 +08:00
int n1 = gcd(k, n), m1 = gcd(k / n1, m);
int n2 = n / n1, m2 = m / m1;
if (n2 * m2 / 2 * 2 == s) //*2<><32>Ϊ<EFBFBD><CEAA>ʼʱs*=2;
2022-08-13 14:22:41 +08:00
{
2022-08-15 08:28:33 +08:00
printf("YES\n0 0\n%d 0\n0 %d", n2, m2);
}
else if (n2 * 2 <= n)
{
printf("YES\n0 0\n%d 0\n0 %d", n2 * 2, m2);
2022-08-13 14:22:41 +08:00
}
else
{
2022-08-15 08:28:33 +08:00
printf("YES\n0 0\n%d 0\n0 %d", n2, m2 * 2);
2022-08-13 14:22:41 +08:00
}
return 0;
2022-08-15 08:28:33 +08:00
}