1 / 4

11490: Just Another Problem

11490: Just Another Problem. ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 1 1490: Just Another Problem 解題者: 蔡權昱 解題日期: 200 8 年 10 月 13 日.

Download Presentation

11490: Just Another Problem

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. 11490: Just Another Problem • ★★★☆☆ • 題組:Problem Set Archive with Online Judge • 題號:11490:Just Another Problem • 解題者:蔡權昱 • 解題日期:2008年10月13日

  2. 題意:假設有96個士兵排排站, 但是仔細數過後發現, 只要再補8個人就可以湊成一長方形(如右圖),題目會給你S, 問你還要多少人才可以湊成長方形.限制:1.只能把人補在中間, 且必須補成兩個等大的正方形.所以補的人數限制為2 * n22.在還沒補人之前的隊形, 必須每個地方的寬度都相同.如圖箭頭寬度皆為t.Ps. 輸出請modulo100000007

  3. 題意範例:Sample input 96102111000 Sample outputPossible Missing Soldiers = 8No Solution PossiblePossible Missing Soldiers = 553352Possible Missing Soldiers = 308898Possible Missing Soldiers = 45000Possible Missing Soldiers = 3528

  4. 解法:math另N=2*n2, 固定寬度為t依題意可知, S+N=(2t+n) * (3t+2n)=>S+2*n2=6t2+7*t*n + 2*n2=> S = 6t2+7*t*n (S,t,n皆為正整數) • =>S|t固可先將S質因數分解, 再由S的因數去求n. • 解法範例:96 => 可能的t為1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 96 • 令t= 3代入, 得n=2, 答2*22=8

More Related