传送门

今天的签到题。

有一个很显然的结论,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. Objective C, erum 枚举类型

    typedef NS_ENUM(NSInteger, MYENUM) { TYPE1, TYPE2, TYPE3 };

  2. 富文本编辑器-UEditor

    官方网址:http://ueditor.baidu.com/website/index.html 下载地址:http://ueditor.baidu.com/website/download.html ...

  3. 迷你MVVM框架 avalonjs 1.3.6发布

    本版本是一次重要的升级,考虑要介绍许多东西,也有许多东西对大家有用,也发到首页上来了. 本来是没有1.36的,先把基于静态收集依赖的1.4设计出来后,发现改动太多,为了平缓升级起见,才减少了一部分新特 ...

  4. neo4j 学习-2

    Neo4j 查询例句 MATCH (john {name: 'John'})-[:friend]->()-[:friend]->(fof) RETURN john.name, fof.na ...

  5. chrome 调试参数(鼠标事件)

    1.监听鼠标事件: monitorEvents(document.body, 'mouse') 取消监听: unmonitorEvents(document.body) 原文链接: https://b ...

  6. Retrofit2+Rxjava2 okhttp RxBus 使用记录

    学习 博客 http://blog.csdn.net/r17171709/article/details/51149350 @Query 后面跟要添加的字段 @Path 连接url里面{userId} ...

  7. for循环语句个人小结

    重新看了一下光盘上的用for循环写一个菱形的答案,发现了其实有几点是可以灵活运用的: 1,当定义行数的时候,也可以用相等的间断的数字隔开,比如 for(int a = 5; a >= 1; a- ...

  8. java.lang.Error: Unresolved compilation problem: 解决方案

    严重: Allocate exception for servlet WX_Interfacejava.lang.Error: Unresolved compilation problem: The ...

  9. ubuntu16.04安装virtualbox

    download:download.virtualbox.org/virtualbox/5.0.10/virtualbox-5.0_5.0.10-104061~Ubuntu~trusty_amd64. ...

  10. Intersecting Lines(叉积,方程)

    Intersecting Lines http://poj.org/problem?id=1269 Time Limit: 1000MS   Memory Limit: 10000K Total Su ...