【codeforces 65A】Harry Potter and Three Spells
2024-08-31 13:50:53
【题目链接】:http://codeforces.com/problemset/problem/65/A
【题意】
你有3种魔法;
1.可以将a单位的石头变成b单位的铅
2.可以将c单位的铅变成d单位的金子
3.可以将e单位的金子变成f单位的石头;
问你能不能用这3种魔法通过有限量的石头得到无限量的金子;
【题解】
①这几个数字都大于0
假设一开始你有a*c*e单位的石头;
->换成b*c*e单位的铅
->换成b*d*e单位的金子
->换成b*d*f单位的石头;
若a*c*e< b*d*f则可以在得到一定量的金子的情况下又获得等量的石头;
则可以一直增加金子;则可以获得无限量的金子;
②b,d,f里面有等于0的
d首先不能等于0;
然后,如果c等于0则也可行;
或者c不等于0;
但是b>0且a==0
或者
b>0且a>0且(e==0,f>0)也可行;
【Number Of WA】
1
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("D:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0),cin.tie(0)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 1e6+100;
const int MOD = 1e9+7;
int a,b,c,d,e,f;
int main(){
//Open();
Close();
cin >> a >> b >> c >> d >> e >> f;
if ( (a*c*e < b*d*f) || (d && (!c || (b &&(!a || (!e && f))))))
cout <<"Ron"<<endl;
else
cout <<"Hermione"<<endl;
return 0;
}
最新文章
- Yii2中多表关联查询(join、joinwith)
- MyEclipse使用总结——MyEclipse10安装SVN插件
- 做办公用品、文具方面的 B2C 是否有前景呢?
- hdu 1102 Constructing Roads Kruscal
- [转]Android在eclipse中的快捷键
- 【ROW_NUMBER 函数(Transact-SQL)】
- [Webpack 2] Intro to the Production Webpack Course
- Javaweb 第2天 JavaScript课程
- CentOS系统使用配置文件修改IP地址详细教程
- Python的序列类型——List
- 转自阿里云邪-如何从小白成长为 Apache Committer?
- 工具使用-----Jmeter教程 简单的压力测试
- Python: find the smallest and largest value
- 【DVWA】Web漏洞实战之File Upload
- TJU Problem 2857 Digit Sorting
- Git2:Git基本操作
- LED音乐频谱之概述
- Mysql数据库导出sql脚本
- 学习javscript函数笔记(二)
- LA 4254 贪心
热门文章
- POJ 2187 Beauty Contest( 凸包求最远点对 )
- pycharm 2018 3.4 for mac破解
- leetcode小题解析
- 解决locate无法使用的问题
- 原生ajax的请求过程
- 【 henuacm2016级暑期训练-动态规划专题 A 】Cards
- C/C++拾遗(一):关于数组的指针和数组元素首地址的一道经典题
- 【Bootstrap】一个PC、平板、手机同一时候使用并且美观的登陆页面
- bzoj1082: [SCOI2005]栅栏(二分答案搜索判断)
- CoreData的介绍和使用