프로그래머스. 정수 제곱근 판별 파이썬 풀이

minan·2021년 6월 28일
0

프로그래머스

목록 보기
59/92

프로그래머스. 연습문제. Level 1. 정수 제곱근 판별 파이썬 풀이

문제링크 https://programmers.co.kr/learn/courses/30/lessons/12934

def solution(n):
   	# n이 어떤 양의 정수 x의 제곱근이라면 x+1의 제곱 return
    return int(n**0.5 + 1)**2 if int(n**0.5)**2 == n else -1
profile
https://github.com/minhaaan

0개의 댓글