【链接】 我是链接,点我呀:)

【题意】

题意

【题解】

参考这篇题解:https://blog.csdn.net/mitsuha_/article/details/82825862
为什么可以保证m*gcd(2*n,k)/k是一个整数?
因为先前已经判断过
2*n*m/k是可以整除的。
显然k是被2*n和m两个数字除了之后变成1
2*n贡献的那一部分其实就是gcd(2*n,k)
那么我们显然可以直接用gcd(2*n,k)来代表2*n
所以右边肯定也是能整除的。

【代码】

#include <bits/stdc++.h>
using namespace std;
const int N = 50;
const long long M = 15e6; long long n,m,k;
long long x1,y1,x2,y2,x3,y3; int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin >> n >> m >> k;
if ( (2*n*m)%k!=0){
cout<<"NO"<<endl;
}else{
long long temp = __gcd(2*n,k);
if (temp>1){
x2 = 2*n/temp;
y3 = m*temp/k;
}else{
temp = __gcd(2*m,k);
x2 = n*temp/k;
y3 = 2*m/temp;
}
cout<<"YES"<<endl;
cout<<x1<<" "<<y1<<endl;
cout<<x2<<" "<<y2<<endl;
cout<<x3<<" "<<y3<<endl;
}
return 0;
}

【Codeforces 1030D】Vasya and Triangle的更多相关文章

  1. 【Codeforces 493C】Vasya and Basketball

    [链接] 我是链接,点我呀:) [题意] 题意 [题解] 枚举三分线(离散后)的位置 然后根据预处理的前缀和,快速算出两个队伍的分数. [代码] #include <bits/stdc++.h& ...

  2. 【Codeforces 493D】Vasya and Chess

    [链接] 我是链接,点我呀:) [题意] [题解] 会发现两个皇后之间如果只有奇数个位置 也就是n%2==1 那么第二个人总是赢的 因为如果white往下跑的话,black也能往下跑. 第二个人没有输 ...

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

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

  4. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  5. 【codeforces 766B】Mahmoud and a Triangle

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  6. 【25.33%】【codeforces 552D】Vanya and Triangles

    time limit per test4 seconds memory limit per test512 megabytes inputstandard input outputstandard o ...

  7. 【22.70%】【codeforces 591C】 Median Smoothing

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  8. 【23.26%】【codeforces 747D】Winter Is Coming

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  9. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

随机推荐

  1. Django day 37 网站视频的播放,购物车接口,优惠券表分析

    一:网站视频的播放, 二:购物车接口, 三:优惠券表分析

  2. Linux C编程之二:Linux基础

    1.Linux的特点 (1)Linux就是一个操作系统(作为用户和计算机之间接口的软件程序) 注:操作系统的功能:命令解释,进程管理,内存管理,输入输出(I/O)操作和外围设备管理,文件管理 (2)特 ...

  3. laravel 模型 $table $guarded $hidden

     首先以App\User模型为例 1.$table属性 表名,对应数据库中的表名 2.guarded)属性 guarded表示在create()方法中不能被赋值的字段 3.$hidden属性 $hid ...

  4. [Usaco2018 Open]Milking Order

    Description Farmer John的N头奶牛(1≤N≤10^5),仍然编号为1-N,正好闲得发慌.因此,她们发展了一个与Farmer John每天早上为她们挤牛奶的时候的排队顺序相关的复杂 ...

  5. 关于.Net中Process的使用方法和各种用途汇总(一):Process用法简介

    简介: .Net中Process类功能十分强大.它可以接受程序路径启动程序,接受文件路径使用默认程序打开文件,接受超链接自动使用默认浏览器打开链接,或者打开指定文件夹等等功能. 想要使用Process ...

  6. EasyUI系列学习(六)-Tooltip(提示框)

    一.创建组件 0.Tooltip不依赖其他组件 1.使用class加载 <a href="#" class="easyui-tooltip" title= ...

  7. Objective-C设计模式——单例Singleton(对象创建)

    单例 和其它语言的单例产不多,可以说是最简单的一种设计模式了.但是有几个点需要注意下,单例就是一个类只有一个实例. 所以我们要想办法阻止该类产生别的实例,一般语言中都会将构造函数写为private.但 ...

  8. [oracle]表空间情况查看、占用、扩容、使用情况、空间维护等操作

    --查询表空间使用情况SELECT Upper(F.TABLESPACE_NAME)         "表空间名",       D.TOT_GROOTTE_MB          ...

  9. MySQL(四)DQL语言——条件查询

    摘要:条件查询:条件表达式,逻辑表达式,模糊查询,like,通配符,转义字符,escape关键字,between and,in,is null,is not null,安全等于. 条件查询语法: SE ...

  10. 【原】Mysql存储关联数组

    $fruits= array("apple" => "苹果", "banana" => "香蕉"," ...