[Python] ๋ฐฑ์ค€ 10178 - ํ• ๋กœ์œˆ์˜ ์‚ฌํƒ•
ยท
Algorithm
๋ฌธ์ œ ํ• ๋กœ์œˆ๋ฐ์ด์— ํ•œ์‹ ์ด๋„ค๋Š” ์•„๋ถ€์ง€๊ฐ€ ์‚ฌํƒ•์„ ๋‚˜๋ˆ ์ฃผ์‹ ๋‹ค. ํ•˜์ง€๋งŒ ํ•œ์‹ ์ด์˜ ํ˜•์ œ๋“ค์€ ์„œ๋กœ ์‚ฌ์ด๊ฐ€ ์ข‹์ง€์•Š์•„ ์„œ๋ฅธ์ด ๋„˜์–ด์„œ๋„ ์‚ฌํƒ•์„ ๊ณต์ •ํ•˜๊ฒŒ ๋‚˜๋ˆ„์–ด ์ฃผ์ง€ ์•Š์œผ๋ฉด ์„œ๋กœ ์‹ธ์›€์ด ๋‚œ๋‹ค. ๋งค๋…„ ํ• ๋กœ์œˆ๋ฐ์ด๋•Œ๋งˆ๋‹ค ์•„๋ถ€์ง€๋Š” ์‚ฌํƒ•์„ ์ž์‹๋“ค์—๊ฒŒ ์ตœ๋Œ€ํ•œ ๋งŽ์€ ์‚ฌํƒ•์„ ๋‚˜๋ˆ„์–ด ์ฃผ์‹œ๊ธฐ ์›ํ•˜๋ฉฐ ์ž์‹ ์—๊ฒŒ๋Š” ๋ช‡๊ฐœ๊ฐ€ ๋‚จ๊ฒŒ๋˜๋Š”์ง€์— ์•Œ๊ณ  ์‹ถ์–ด ํ•˜์‹ ๋‹ค. ์ด๋Ÿฐ ์•„๋ถ€์ง€๋ฅผ ๋„์™€์„œ ํ˜•์ œ๊ฐ„์˜ ์‹ธ์›€์„ ๋ง‰์•„๋ณด์ž. ์ž…๋ ฅ ๊ฐ€์žฅ ์ฒซ ๋ฒˆ์งธ ์ค„์—๋Š” ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค์˜ ์ˆ˜๊ฐ€ ์ž…๋ ฅ๋˜๊ณ , ๊ฐ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋งˆ๋‹ค ์‚ฌํƒ•์˜ ๊ฐœ์ˆ˜์™€ ํ˜•์ œ์˜ ์ˆ˜๊ฐ€ ์ฐจ๋ก€๋Œ€๋กœ ์ž…๋ ฅ๋œ๋‹ค. ์ถœ๋ ฅ ์ถœ๋ ฅ์€ ์˜ˆ์ œ๋ฅผ ๋ณด๊ณ  ”You get __ piece(s) and your dad gets __ piece(s).” ํ˜•์‹์— ๋งž์ถ”์–ด ์ ์ ˆํ•˜๊ฒŒ ์ถœ๋ ฅํ•˜๋ผ. ์ •๋‹ต t = int(input()) for i in range(t):..