Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 10520: Determine it 星等:★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10520: Determine it 解題者:林祺光 解題日期: 2006 年 5 月 22 日 題意:給兩個值 a 1,n 和 n a i,j.

Similar presentations


Presentation on theme: "1 10520: Determine it 星等:★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10520: Determine it 解題者:林祺光 解題日期: 2006 年 5 月 22 日 題意:給兩個值 a 1,n 和 n a i,j."— Presentation transcript:

1 1 10520: Determine it 星等:★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10520: Determine it 解題者:林祺光 解題日期: 2006 年 5 月 22 日 題意:給兩個值 a 1,n 和 n a i,j 的定義為 求 a n, 1 的值 0<a 1,n <500,0<n<20

2 2 題意範例 : 輸入 4 1 等於是將 n 設為 4 設為 1 題目所求的為 利用 Recursive fuction 可求出 為 42 解法: DP&Rucursive 利用一個 20 × 20 的 table 紀錄 的值避免 recursive 多餘 的計算一開始先將 填入 table 中,在呼叫 Recursive fuction 求 計算時如果有需要的 值先到 table 中 查詢,如果 table 中沒有則呼叫 fuction 求值

3 3 解法 ( 續 ) 觀察後可發現所建的 table 具有遞增的特性 如 4,1 所見的 table 為 依照這個規律就可以省去非常多呼叫 fuction 的時間 8421 211362 3426134 4234218

4 4 解法範例:無 討論:是否有更快的解法 ?


Download ppt "1 10520: Determine it 星等:★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10520: Determine it 解題者:林祺光 解題日期: 2006 年 5 月 22 日 題意:給兩個值 a 1,n 和 n a i,j."

Similar presentations


Ads by Google