728x90
9724번: Perfect Cube
A perfect cube is an integer whose cube root is also an integer. For example 1, 8, 27, 64, 125, etc. are examples of perfect cubes but 9, 25 and 113 are not. Given two positive integers A and B, your task is to calculate the number of perfect cubes in the
www.acmicpc.net
문제 풀이
두 입력값 A와 B 사이의 완전 세제곱수의 갯수를 출력해준다.
정답 코드
for i in range(1, int(input()) + 1) :
A, B = map(int, input().split())
cnt = 0
x = 1
while x ** 3 <= B :
if x ** 3 >= A : cnt += 1
x += 1
print(f"Case #{i}: {cnt}")
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 9773 - ID Key [python] (0) | 2023.03.27 |
---|---|
[BOJ/백준] 9771 - Word Searching [python] (0) | 2023.03.27 |
[BOJ/백준] 9723 - Right Triangle [python] (0) | 2023.03.27 |
[BOJ/백준] 9713 - Sum of Odd Sequence [python] (0) | 2023.03.27 |
[BOJ/백준] 9699 - RICE SACK [python] (0) | 2023.03.27 |