1 / 4

11350:Stren-Brocot Tree

11350:Stren-Brocot Tree. ★★☆☆ 題組: Contest Archive with Online Judge 題號: 11350: Stren-Brocot Tree 解題者: 李育賢 解題日期: 2008 年 12 月 7 日 題意: Stern-Brocot tree 可以表示所有的分數。設最右界為無限大,最左界為0 。目前的值就是之前左右邊界分子分母個別相加(參考下頁圖)。給一個字串(長度最大 90 )只包含 L 和 R , L 往左, R 往右,問最後得到的分數為何 ?. 題意範例: Sample Input: 3 RL

Download Presentation

11350:Stren-Brocot Tree

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 11350:Stren-Brocot Tree • ★★☆☆ • 題組:Contest Archive with Online Judge • 題號:11350: Stren-Brocot Tree • 解題者:李育賢 • 解題日期:2008年12月7日 • 題意:Stern-Brocot tree 可以表示所有的分數。設最右界為無限大,最左界為0。目前的值就是之前左右邊界分子分母個別相加(參考下頁圖)。給一個字串(長度最大 90)只包含 L 和 R, L 往左,R往右,問最後得到的分數為何?

  2. 題意範例:Sample Input: 3 RL RLR RRL Sample Output: 3/2 5/3 5/2

  3. 解法:直接作即可,但注意需用long long。

More Related