Presentation is loading. Please wait.

Presentation is loading. Please wait.

10489: Boxes of Chocolates ★★☆☆☆

Similar presentations


Presentation on theme: "10489: Boxes of Chocolates ★★☆☆☆"— Presentation transcript:

1 10489: Boxes of Chocolates ★★☆☆☆
題組:Problem Set Archive with Online Judge 題號:10489: Boxes of chocolates 解題者:曹惟森 解題日期:2018年4月12日 題意:有B個盒子,每個盒子中有a1個小盒子,每個小盒子裡面還有a2個更小的盒子,最小的盒子裡有ak個巧克力,問把巧克力分給N個人後的餘數。

2 題意範例: 分給5人 有2行測資 後面有3個數字 有2*3*4顆 後面有4個數字 有5*2*3*1顆 共有24+30=54顆 54*5=10……4,剩餘4顆 解法:a (mod n)*b(mod n) ≡ (a*b)(mod n) a (mod n)+b(mod n) ≡ (a+b)(mod n) 解法範例: 2(mod 5)*3(mod 5) ≡6(mod 5)=1 1(mod 5)*4(mod 5) ≡4(mod 5)=4 第一盒剩4顆 5(mod 5)*2(mod 5) ≡10(mod 5)=0 (0*3*1)(mod 5)= 第二盒剩0顆 (4+0)(mod 5)= 共剩4顆 討論:無


Download ppt "10489: Boxes of Chocolates ★★☆☆☆"

Similar presentations


Ads by Google