Nyoj 949 Harry Potter (detail)

Source: Internet
Author: User

Harry Potter time limit: 1000 MS | memory limit: 65535 kb difficulty: 3
Description

Harry learned three new ways of magic. He could use the first magic to turn a gram of sand into B grams of metal. He could use the second magic to turn C grams of metal into D grams of gold, you can use the third magic to turn e-grams of gold into F-grams of sand. Harry's two friends Ron and Hermione are very happy to know, but Ron and Hermione have a disagreement, Ron thinks Harry can use these three magic to get infinite gold, hermione felt that there could be no limit. Harry wants to know who is right.

Input
Input 6 integers A, B, C, D, E, F
(0 <= A, B, C, D, E, F <= 1000)
Output
The output is correct. If Ron is the correct output, "Ron" is output; otherwise, "Hermione" is output"
Sample Input
100 200 250 150 200 50 250100 200 200 1001 1 0 1 1100 1 100 1 0 1
Sample output
Ronhermioneronron
Uploaded

ACM _ Wang Ying

Idea: forward to gold, "reverse gold (Ron)

Forward: K = B/c * d

Reverse: q = (k/E) * F

W = (Q/a) * B

P = (W/C) * D // reverse gold

Note that the input value can be 0.

1. When a = 0 BCD, infinite gold ron C = 0 & D infinitely turns out gold Ron

2. When (a = 0 | C = 0 | E = 0) & B, D, and F are infinite gold

3. when (A = 0 & B = 0) | (E = 0 & F = 0) | (C = 0 & D = 0) there is a link in herminoe that cannot be converted

(The syy code is simpler than the one I wrote)


 #include<stdio.h>int main(){    double a,b,c,d,e,f;    while(~scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f))    {        if(c==0&&d)        {            printf("Ron\n");            continue;        }        if(a==0&&b&&c&&d)        {            printf("Ron\n");            continue;        }        if((a==0||c==0||e==0)&&b&&d&&f)        {            printf("Ron\n");            continue;        }        if((a==0&&b==0)||(e==0&&f==0)||(c==0&&d==0))        {            printf("Hermione\n");            continue;        }        double k=(b/c)*d;        double q=(k/e)*f;        double w=(q/a)*b;        double p=(w/c)*d;        if(p>k)            printf("Ron\n");        else            printf("Hermione\n");    }    return 0;}  



Nyoj 949 Harry Potter (detail)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.