【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 ...
随机推荐
- bzoj 1232: [Usaco2008Nov]安慰奶牛cheer【最小生成树】
有趣 每条边在算答案的时候被算了二倍的边权值加上两个端点的权值,然后睡觉点额外加一次 所以可以用这个权做MST,然后加上点权最小的点 #include<iostream> #include ...
- 10.12NOIP模拟题(1)
#include<iostream> #include<cstdio> #include<cstring> #include<queue> #defin ...
- Juicer.js模板引擎问题
由于jsp中的EL表达式语法和jquery.tmpl十分类似,,所以单纯的使用${name},数据是渲染不上tmpl的. SO.. 要加上转义: ${'${'}amount} 或者 \${amount ...
- SQL 理论知识总结
1..如何设计数据库 答:存储信息的大小,每次扩容的大小,冗余 2.SQL Server的两种索引是何形式?索引的作用?索引的优缺点? 答:集聚索引,非聚集索引.提高查询速度.但是会过多的占用磁盘空间 ...
- KMP POJ 2406 Power Strings
题目传送门 /* 题意:一个串有字串重复n次产生,求最大的n KMP:nex[]的性质应用,感觉对nex加深了理解 */ /************************************** ...
- Oracle随机选择一条记录SQL
Oracle随机选择一条记录SQL:
- .net中RSA加密解密
1.产生密钥: private static void CreateKey() { using (RSACryptoServiceProvider rsa = new RSACryptoService ...
- ASP.NET MVC应用程序中支持用户使用腾讯QQ和微信以及新浪微博的第三方登录
什么是第三方授权登录,就是一些大家都会有的帐号如QQ.微信.淘宝.微博等账户.通过那些巨头公司提供的api直接实现登录. 当然,我们是不可能得到你的用户名和密码的.不了解的人,可能会存在这个疑虑.我们 ...
- TCP流量控制与拥塞解决
滑动窗口 但要提高网络利用率: nagle算法 - 延迟 慢启动.拥塞避免 发送端主导cwnd init set ssthresh & cwnd = swnd loop : 网不阻塞 ...
- 一个用pyton写的监控服务端进程的软件hcm
使用udp实现,简单,方便,不用三次握手 1. 所有部署服务器进程的机器有一个代理进程hagent,用来监听hcm console中发送过来的命令 2.hcm需要提供以下命令 start :普通方式启 ...