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

Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1) D. Vasya and Triangle

程序员文章站 2022-05-09 22:49:50
...

题目链接:http://codeforces.com/contest/1058/problem/D
c++代码:

#include <iostream>

using namespace std;

typedef long long LL;

LL gcd(LL a,LL b) {
	return b==0?a:gcd(b,a%b);
}


int main() {
	LL n,m,k;
	cin >> n >> m >> k;
	if(2*n*m%k)cout <<"NO" <<endl;
	else {
		LL g=gcd(2*n,k);
		cout << "YES" <<endl;
		cout << 0 <<" "<<0 <<endl;
		if(g==1) {
			cout << n <<" " <<0 <<endl;
			cout << 0 << " " << 2*m/k <<endl;
		}
		else {
			cout << 2*n/g<<" "<<0<<endl;
			cout <<0<<" "<<m*g/k <<endl;
		}
		
		
	}
	
	return 0;
}