๐ป Coding Problems Solving/Brute Force
[ํ๋ก๊ทธ๋๋จธ์ค] LV.2 ์นดํซ
Kim_dev
2022. 4. 16. 16:05
[ํ๋ก๊ทธ๋๋จธ์ค] LV.2 ์นดํซ
brown yellow ๊ฐ๊ฐ์ด ์ฃผ์ด์ง๊ณ
๊ฐ๋ก์ธ๋ก ๊ธธ์ด ๊ตฌํ๋ ๋ฌธ์
2. ํ์ด
yellow๊ฐ ๋ฐ๊นฅ ์ฌ๊ฐํ์ ๊ฐ๋ก-2, ์ธ๋ก-2๊ฐ ๋๋ ๊ท์น์ ์ฐพ์ ์ ์์ด์ผํ๋ค.
3. ์ฝ๋
def solution(brown, yellow):
s = brown + yellow
for i in range(s, 2, -1):
if s % i == 0:
a = s//i
if yellow == (i-2) * (a-2):
return [i, a]