传送门

今天的签到题。

有一个很显然的结论,gcd(n∗m,k)≤2gcd(n*m,k)\le 2gcd(n∗m,k)≤2。

本蒟蒻是用的行列式求三角形面积证明的。

如果满足这个条件,就可以直接构造出一个满足限制的直角三角形了。

代码:

#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll read(){
	ll ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
ll n,m,k;
inline ll gcd(ll a,ll b){while(b){ll t=a;a=b,b=t%a;}return a;}
int main(){
	n=read(),m=read(),k=read();
	ll g=gcd(n,k),ttmp,f=-1;
	n/=g,k/=g;
	if(g!=1)f=1,ttmp=g;
	g=gcd(m,k);
	m/=g,k/=g;
	if(g!=1)f=2,ttmp=g;
	if(k>2){puts("NO");return 0;}
	puts("YES");
	if(k==1){
		if(f==1)n*=2;
		else m*=2;
	}
	printf("0 0\n%I64d 0\n0 %I64d",n,m);
	return 0;
}

2018.09.23 codeforces 1053A. In Search of an Easy Problem(gcd)的更多相关文章

  1. codeforces A. In Search of an Easy Problem

    A. In Search of an Easy Problem time limit per test 1 second memory limit per test 256 megabytes inp ...

  2. 2018.09.23 codeforces 1053B. Vasya and Good Sequences(前缀和)

    传送门 考试的时候卡了一会儿. 显然这个答案只跟二进制位为1的数量有关. 还有一个显然的结论. 对于一个区间[l,r][l,r][l,r],如果其中单个数二进制位为1的数量最大值不到区间所有数二进制位 ...

  3. CodeForces - 1058A. In Search of an Easy Problem

    这题,全零是esay有1是hard,真难呀. #include<bits/stdc++.h> using namespace std; int main(){ int n,i,x,flag ...

  4. Codeforces Round #367 (Div. 2) C. Hard problem(DP)

    Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solvin ...

  5. codeforces#1157D. Ehab and the Expected XOR Problem(构造)

    题目链接: http://codeforces.com/contest/1174/problem/D 题意: 构造一个序列,满足以下条件 他的所有子段的异或值不等于$x$ $1 \le a_i< ...

  6. The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online -C:Halting Problem(模拟)

    C Halting Problem In computability theory, the halting problem is the problem of determining, from a ...

  7. 【LeetCode】95. Unique Binary Search Trees II 解题报告(Python)

    [LeetCode]95. Unique Binary Search Trees II 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzh ...

  8. C#/AutoCAD 2018/ObjectArx/二次开发添加圆对象的的例子(五)

    C#/AutoCAD 2018/ObjectArx/二次开发添加圆对象的的例子(五) 1.创建一个图形对象的步骤如下见上一篇博客(三)2.添加删除实体的工具函数见上一篇博客(四) 3.添加圆的例子(完 ...

  9. Leetcode35 Search Insert Position 解题思路(python)

    本人编程小白,如果有写的不对.或者能更完善的地方请个位批评指正! 这个是leetcode的第35题,这道题的tag是数组,python里面叫list,需要用到二分搜索法 35. Search Inse ...

随机推荐

  1. as3与php交互

    (1)直接读取 php: <? $state="开始接收"; $var1="收到"; echo "state=".$state.&qu ...

  2. MFC-Dialog各函数的执行顺序

    CDlgTestDlg::CDlgTestDlg CDlgTestDlg::DoModal CDialog::DoModal CDlgTestDlg::PreSubclassWindow CDlgTe ...

  3. ABAP-FTP通用操作

  4. 编写ios和android共用的c/c++库时 使用iconv的问题(转)

    因为在项目中需要同时维护ios和Android,不同的代码不利于开发的便捷和以后的维护,所以在最近的一个项目中,两种手机应用的通信部分打算使用c/c++库来统一编写,ios调用.a静态库,androi ...

  5. MySQLReport

    简介: MySQLReport 一.安装 shell > yum -y install mysqlreport perl-DBD-MySQL 二.使用 shell > mysqlrepor ...

  6. Object-c 创建按钮

    @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; //动态创建我们自己的按钮 //1.创建按钮(UIB ...

  7. [ERR] Not all 16384 slots are covered by nodes.

    redis集群开不起来,用redis-cli连接的时候出现如下错误: CLUSTERDOWN The cluster is down 然后使用redis-trib.rb检查: ./redis-trib ...

  8. C语言高级-结构,共用体,文件,链表

    C语言结构 标准声明方式 struct student{        int age;        char sex;    }; 这个可以在main函数中定义:  struct student ...

  9. Week4-作业1:阅读笔记与思考

    我在这三天时间里阅读了<构建之法>的第四章和第十七章,产生了一些疑问和深层次的思考. 第四章 问题1: 书中第68页提到“注释(包括所有源代码)应该只用ASCII字符,不要用中文或其他特殊 ...

  10. dhtmlx uploader使用

    前端:{type : "upload", mode : "html4", name : "importFile", inputWidth : ...