11350 - Stern-Brocot Tree
Solution Description : Ad hoc problem First set a=0; b=1; c=1; d=0; x=(a+b); y=(c+d) If you got 'R' then a=x and c=y if you got 'L' then b=x and d=y set x=a+b and y=c+d print x/y Use long data type for all calculation |
||||||||||
11350 - Stern-Brocot Tree
Solution Description : Ad hoc problem First set a=0; b=1; c=1; d=0; x=(a+b); y=(c+d) If you got 'R' then a=x and c=y if you got 'L' then b=x and d=y set x=a+b and y=c+d print x/y Use long data type for all calculation |
||||||||||