logarithm1 [백준] 15917 1 2 3 4 5 6 7 8 9 10 import sys import math def log2(x): return (math.log10(x) / math.log10(2) ) def isPower2(n): if (math.ceil(log2(n))== math.floor(log2(n))) : return 1 else: return 0 for _ in range(int(sys.stdin.readline())): a=int(sys.stdin.readline()) print( isPower2(a) ) Colored by Color Scripter cs 본 문에서 주어진 힌트와 유사한 방법 이겠네요 엄청나게 큰 수나 엄청나게 작은 수를 다루기 위해 지수와 로그 개념이 도입됩니다. 그리고 로그의 성질을 이용해서 ex.. 2021. 1. 4. 이전 1 다음