传送门

今天的签到题。

有一个很显然的结论,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. HTML5 Canvas ( 图片绘制 转化为base64 ) drawImage,toDataURL

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. HTML5 Canvas ( 线段的绘制 ) beginPath, moveTo, strokeStyle, stroke

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. Win10 C盘根目录权限

    cmd管理员运行 icacls c:\ /setintegritylevel M c盘属性,安全,完全控制.

  4. static 和 global

    global global关键字如果用在function内部,则说明这个function内用的这个变量是全局的,全局变量就是在整个页面里都能起作用.例如 $conf = 1; function con ...

  5. 使用SimpleXML 解析xml

    最近搞解析XML搞的我是水深火热的,所以打算对PHP5解析XML做个学习小结.今天介绍下与PHP5捆绑在一起的SimpleXML扩展,这个用于可读写XML的新的API,让解析XML不再繁琐和困难,用起 ...

  6. 基于OpenGL编写一个简易的2D渲染框架-06 编写一个粒子系统

    在这篇文章中,我将详细说明如何编写一个简易的粒子系统. 粒子系统可以模拟许多效果,下图便是这次的粒子系统的显示效果.为了方便演示,就弄成了一个动图. 图中,同时显示了 7 种不同粒子效果,看上去效果挺 ...

  7. something about facebook token

    There are two method origin token , you can use any one of them, first one may be easier. Origin fro ...

  8. Hystrix-超时设置

    由于客户端请求服务端方法时,服务端方法响应超过1秒将会触发降级,所以我们可以配置Hystrix默认的超时配置 如果我们没有配置默认的超时时间,Hystrix将取default_executionTim ...

  9. Overcoming Life's Obstacles - ASC 2017 March 03-04

    <Overcoming Life's Obstacles - How a top oboist overcame a neurological disorder to play again> ...

  10. 大型运输行业实战_day03_2_使用ajax将请求页面与请求数据分离

    1.引入jquery 1.添加jquery包 2.在要使用jquery的页面中引入jquery 引入jquery后必须检查是否引入正确,这里值得注意的是 springMVC默认情况先会拦截 js文件, ...