【题目链接】: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;
}

【codeforces 65A】Harry Potter and Three Spells的更多相关文章

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

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

  2. 【codeforces 707E】Garlands

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

  3. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  4. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  5. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  6. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

  7. 【Codeforces 429D】 Tricky Function

    [题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...

  8. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  9. 【codeforces 515D】Drazil and Tiles

    [题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...

随机推荐

  1. Linux之awk使用

    基本语法 $n :当前记录的第n个字段,比如n为1表示第一个字段,n为2表示第二个字段 $0:执行过程中当前行的文本内容 \t:制表符 \n:换行符 -F'[:#/]' : 定义三个分隔符,注意有-F ...

  2. Android开发新手HelloWorld解析

    首先看这个 HelloWorld 类. Java代码public class HelloWorld extends Activity {       /** Called when the activ ...

  3. s5pv210 uboot-2012-10移植(二) 之能够启动进入控制台

    这次我们将从官网下载的最新uboot-2012-10移植到s5pv210开发板上,让其进入控制台,效果如下: 首先,我暂时没采用内核的SPL,这个将在后面给补上,这里的BL1是我自己参考资料写的,我用 ...

  4. ASP.NET-入门

    MVC5特点 1.One ASP.NET统一平台  2.Bootstrap 免费CSS,响应式页面 3.路由标记属性:简单.控制器.操作.前缀.参数.URL 4.ASP.NET web API 2 : ...

  5. POJ——T2421 Constructing Roads

    http://poj.org/problem?id=2421 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 24132   ...

  6. [React] Use the new React Context API

    The React documentation has been warning us for a long time now that context shouldn't be used and t ...

  7. [ReactVR] Add Lighting Using Light Components in React VR

    In order to illuminate a scene containing 3D objects a lighting setup is required. In this lesson we ...

  8. node之版本号升级和管理

    如今非常多人预计和我一样项目中已经開始应用起nodeJS,而伴随着项目的需求,对nodejs版本号也有着各种需求.好了直接进入主题,如今node版本号管理网上有非常多方式.这里说两种: 第一种modu ...

  9. sql server2008对字符串日期字段分区

    近期对公司产品的日志数据库做了一个数据分区,数据库使用的是sql server 2008,这里给大家提供一个參考. 须要特别说明的是,非常多网上的样例分区字段都使用的是时间类型的.而这里因为时间字段原 ...

  10. windows上通过vnc连接虚拟机中linux系统

    首先要在虚拟机中安装vnc. 虚拟机的设置中要启用VNC连接. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHdzc2c=/font/5a6L5L2T/ ...