D. Vasya and Triangle
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Vasya has got three integers n, m and k. He’d like to find three integer points (x1,y1), (x2,y2), (x3,y3), such that 0≤x1,x2,x3≤n, 0≤y1,y2,y3≤m and the area of the triangle formed by these points is equal to nmk.

Help Vasya! Find such points (if it’s possible). If there are multiple solutions, print any of them.

Input
The single line contains three integers n, m, k (1≤n,m≤109, 2≤k≤109).

Output
If there are no such points, print “NO”.

Otherwise print “YES” in the first line. The next three lines should contain integers xi,yi — coordinates of the points, one point per line. If there are multiple solutions, print any of them.

You can print each letter in any case (upper or lower).

Examples
inputCopy
4 3 3
outputCopy
YES
1 0
2 3
4 1
inputCopy
4 4 7
outputCopy
NO
Note
In the first example area of the triangle should be equal to nmk=4. The triangle mentioned in the output is pictured below:

In the second example there is no triangle with area n*m/k=16/7.


不要被他给的图迷惑,这就是个水题。

include<iostream>
using namespace std;
int main()
{long long  int n,m,k,i;cin>>n>>m>>k;if((n*m)%(2*k)!=0){cout<<"NO";return 0;}for(i=1;i<=m;i++){if((n*i)==(2*n*m)/k){cout<<"YES"<<endl;cout<<0<<' '<<0<<endl;cout<<0<<' '<<n<<endl;cout<<n<<' '<<i<<endl;return 0;}}for(i=1;i<=n;i++){if((m*i)==(2*n*m)/k){cout<<"YES"<<endl;cout<<0<<' '<<0<<endl;cout<<0<<' '<<m<<endl;cout<<0<<' '<<i<<endl;return 0;}}
}

CodeForces - 1058D D. Vasya and Triangle相关推荐

  1. Codeforces 1058 D. Vasya and Triangle 分解因子

    传送门:http://codeforces.com/contest/1058/problem/D 题意: 在一个n*m的格点中,问能否找到三个点,使得这三个点围成的三角形面积是矩形的1/k. 思路: ...

  2. 【Codeforces】1065B Vasya and Isolated Vertices (无向图的)

    http://codeforces.com/problemset/problem/1065/B 一个图,给定顶点数,边数,求解最小孤立点数和最大孤立点数 最小的话,一个边连接两个顶点成为一个整体,如果 ...

  3. CodeForces 1058C C. Vasya and Golden Ticket

    C. Vasya and Golden Ticket time limit per test1 second memory limit per test256 megabytes inputstand ...

  4. 【CodeForces - 1051C 】Vasya and Multisets (模拟)

    题干: Vasya has a multiset ss consisting of nn integer numbers. Vasya calls some number xxnice if it a ...

  5. 【CodeForces - 1051A】Vasya And Password (构造,水题)

    题干: Vasya came up with a password to register for EatForces - a string ss. The password in EatForces ...

  6. 【CodeForces 577C】Vasya and Petya’s Game

    链接 某个数x属于[1,n],至少询问哪些数y"x是否是y的倍数"才能判断x. 找出所有质因数和质因数的幂即可. #include<cstdio> #include&l ...

  7. 【Codeforces】A3组刷题记录( 43 / 43 )

    目录 A1. Combination Lock A2. Summer Camp rzt A3. Soft Drinking ★A4. Coder ★A5. GukiZ and Contest ★A6. ...

  8. OI每周刷题记录——lrllrl

    看这标题就知道我是模仿的hzwer大佬,远程%%% 大佬的OI经历让蒟蒻我深受感触,为了晚一些AFO本蒟蒻也得加油了 从高二上期第一周开始计数,每个星期天更一次,一直更到我AFO 如果这是我此生最后一 ...

  9. android 上午零点格式,Android零点一度的区别——Matrix

    2013-07-07 导语:Matrix是android中对图像绘制的处理(旋转.放缩.平移等等),貌似书本翻页就是用这种方式处理的 正文: 1.基于坐标(px,py)旋转degrees度, post ...

最新文章

  1. Python学习笔记——文件写入和读取
  2. python x y z 1_Python下的数值列表 - range(x,y,z)函数
  3. Jenkins搭建的几个坑记下
  4. LeetCode题组:第914题-卡牌分组
  5. 动态资源和静态资源分离
  6. 图片 过度曝光_解读:摄影初学者,如何理性处理“曝光不足”与“曝光过度”...
  7. redis java 缓存服务器_java中对Redis的缓存进行操作
  8. django 跳转其他网站_Django 实战 | 搭一个 GitHub 用户展示网站 04
  9. POJ 1015 Jury Compromise dp分组
  10. MongoDBTool - 测试版【GUI美化完毕】 源代码发布 --MongoDB爱好者,Winform爱好者 请进...
  11. java高级进阶面试题
  12. 分享一个小软件fences(桌面管理软件)
  13. 下等人薄情,中等人深情,上等人……
  14. Arithmetic Code 算术编码
  15. 强化学习导论_Example 6.5: Windy Grid-world
  16. vue 下载文件流和捕获后端返回的状态码和错误信息的方法
  17. 系统集成考试口诀万金油记忆
  18. GMT所提供的所有命令和其功能
  19. android json解析优秀文章
  20. 解决联想e470c 无线网卡驱动

热门文章

  1. The executable was signed with invalid entitlements
  2. 第10章 springboot是什么
  3. 实现 VUE 中 MVVM - step10 - Computed
  4. 判断设备是否是iphone5 及对iphone5 屏幕的适应
  5. 保存cisco设备配置
  6. Subversion 1.5 安装配置指南
  7. 鸿蒙系统cpu,鸿蒙系统,再加上自研电脑CPU,华为在下一盘很大的棋? - 区块网...
  8. u盘linux软件下载,u盘linux制作工具(Universal USB Installer)
  9. Java元数据区的概念_java之元数据(metadata)-Go语言中文社区
  10. java文件下载controller_Java Spring MVC 上传下载文件配置及controller方法详解