728x90
๋ฐ์ํ
https://school.programmers.co.kr/learn/courses/30/lessons/120884
ํ๋ก๊ทธ๋๋จธ์ค
SW๊ฐ๋ฐ์๋ฅผ ์ํ ํ๊ฐ, ๊ต์ก, ์ฑ์ฉ๊น์ง Total Solution์ ์ ๊ณตํ๋ ๊ฐ๋ฐ์ ์ฑ์ฅ์ ์ํ ๋ฒ ์ด์ค์บ ํ
programmers.co.kr
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ฉํ ์คํธ ์ ๋ฌธ ๋ฌธ์ ์ค ํ๋.
10์ผ๋ก ๋๋ ๋ค ๋จ์ ์ฟ ํฐ ์๋ฅผ ๊ณ ๋ คํด์ผ ํด์ ์๊ฐ๋ณด๋ค ํท๊ฐ๋ ธ๋ค,,!
function solution(chicken) {
let coupons = chicken;
let answer = 0;
while(1){
answer += Math.floor(coupons/10);
coupons = Math.floor(coupons/10) + (coupons%10);
if(coupons==0 || Math.floor(coupons/10)==0) break;
}
return answer;
}
728x90
๋ฐ์ํ
'๐ ์๊ณ ๋ฆฌ์ฆ > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Javascript/PGS] Lv.0 : ๋ค์์ ์ฌ ์ซ์ (์ ๋ฌธ 100์ ๋ง์คํฐ!๐ฅ) (0) | 2025.02.11 |
---|---|
[Javascript/PGS] Lv.0 : ์ด์ง์ ๋ํ๊ธฐ (0) | 2025.02.11 |
[Javascript/PGS] Lv.3 : ์ ๊ตญ์ฌ์ฌ (์ด๋ถํ์) (1) | 2025.02.06 |
[Javascript/PGS] Lv.2 : ํ ์ธ ํ์ฌ (์ฌ๋ผ์ด๋ฉ ์๋์ฐ) (0) | 2025.02.06 |
[C++/PGS] Lv.0 : ๋ฑ์ ๋งค๊ธฐ๊ธฐ (0) | 2025.01.13 |