欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

D. Vasya and Triangle(构造)

程序员文章站 2022-03-30 08:23:58
...
int main() //构造
{
	//freopen("in.txt", "r", stdin);
	ll m, n, k;
	while (cin >> n >> m >> k)
	{
		if (2 * n*m%k != 0) { puts("NO");continue; }
		ll d = gcd(2 * m, k);
		puts("YES");
		cout << "0 0" << endl;
		if (d == 1)//n%k==0
		{
			cout << n * 2 / k <<" "<<0<< endl;
			cout << 0 << " " << m << endl;
		}
		else
		{
			cout << n*d/k << " " << 0 << endl;
			cout << 0 << " " << m * 2 / d << endl;
		}
	}
	return 0;
}