백준 - 1094 막대기

AekT·2021년 10월 24일
0
post-thumbnail

백준 1094 막대기

문제 : https://www.acmicpc.net/problem/1094

Swift :

var input = Int(readLine()!)!
var res = 0
while input > 0{
    if input%2 == 1{
        res += 1
    }
    input /= 2
}
print(res)
profile
으악

0개의 댓글