【Codeforces 1030D】Vasya and Triangle
【链接】 我是链接,点我呀:)
【题意】
题意
【题解】
参考这篇题解: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的更多相关文章
- 【Codeforces 493C】Vasya and Basketball
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 枚举三分线(离散后)的位置 然后根据预处理的前缀和,快速算出两个队伍的分数. [代码] #include <bits/stdc++.h& ...
- 【Codeforces 493D】Vasya and Chess
[链接] 我是链接,点我呀:) [题意] [题解] 会发现两个皇后之间如果只有奇数个位置 也就是n%2==1 那么第二个人总是赢的 因为如果white往下跑的话,black也能往下跑. 第二个人没有输 ...
- 【CodeForces 577C】Vasya and Petya’s Game
链接 某个数x属于[1,n],至少询问哪些数“x是否是它的倍数”才能判断x.找出所有质因数和质因数的幂即可. #include<cstdio> #include<algorithm& ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【codeforces 766B】Mahmoud and a Triangle
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【25.33%】【codeforces 552D】Vanya and Triangles
time limit per test4 seconds memory limit per test512 megabytes inputstandard input outputstandard o ...
- 【22.70%】【codeforces 591C】 Median Smoothing
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【23.26%】【codeforces 747D】Winter Is Coming
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
随机推荐
- javascript BOM基本知识
1.BOM(Bowser Object Model浏览器对象模型) 浏览器创建的对象通常称作文档(Document)对象,它是浏览器使用的众多对象的一部分,浏览器操作的对象结合起来称作浏览器对象模型( ...
- Bug分支(转载)
转自:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00137602359178 ...
- E20171230-hm
refine vt. 提炼; 改善; 使高雅; revert vi. 恢复; 重提; 回到…上; <律>归还; vt. 使恢复原状; n ...
- JavaSwing输入对话框,点击取消抛出异常的解决方法
在做产品管理系统的时候,遇到一个问题: 在得到一个输入框对话框的时候 String textPrice = JOptionPane.showInputDialog("请输入要调整的价格增(减 ...
- PKUACM 2018 D chocolate【并查集+克鲁斯卡尔】
传送:http://poj.openjudge.cn/practice/C18D/ 依然是课件截图 #include<iostream> #include<cstdio> #i ...
- 清北考前刷题day7早安
- web自动化测试—selenium游览器多窗口操作
# coding=utf-8'''web游览器多窗口操作: 获取当前窗口句柄 current_window_handle 获取所有窗口句柄 window_handles 切换窗口 switch_to_ ...
- Quartz定时调度jar包的执行Demo分享
1.Quartz简介 Quartz框架的核心是调度器.调度器负责管理Quartz应用运行时环境.调度器不是靠自己做所有的工作,而是依赖框架内一些非常重要的部件.Quartz不仅仅是线程和线程管理. ...
- java io 文件下载
/** * 文件下载 * @param response * @param downloadPath * @param docName */ public void downLoadFile( Htt ...
- 2017杭电多校第七场1011Kolakoski
Kolakoski Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Tota ...