Uploaded by
Acm_ Wang Ying
Idea: Forward gold "reverse gold" (Ron)
Forward: K=b/c*d
Reverse: q= (k/e) *f
w= (q/a) *b
p= (w/c) *d//Reverse Gold
Be aware that the input can have 0 so
1.a=0 BCD time Infinite gold Ron C=0&&d infinitely change out of gold Ron
2. When (a=0| | c=0| | e=0) &&b, D, F are also infinite gold
3. When (a==0&&b==0) | | (e==0&&f==0) | | (c==0&&d==0) There is a link in the middle of herminoe that cannot be converted
(The SYY code is simpler than 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;}