2417번
-
[백준] 2417번: 정수 제곱근코딩(Coding)/백준 문제풀이 2021. 1. 5. 14:04
링크: www.acmicpc.net/problem/2417 2417번: 정수 제곱근 정수가 주어지면, 그 수의 정수 제곱근을 구하는 프로그램을 작성하시오. www.acmicpc.net 정수 제곱근 문제 정수가 주어지면, 그 수의 정수 제곱근을 구하는 프로그램을 작성하시오. 입력 첫째 줄에 정수 n이 주어진다. (0 ≤ n < 2^63) 출력 첫째 줄에 q2 ≥ n인 가장 작은 음이 아닌 정수 q를 출력한다. 문제접근 해당문제는 그냥 수학문제이다. python의 제곱연산자("**")를 통해서 문제를 쉽게 해결할 수 있다. 나는 2가지 경우를 나눠서 문제에 접근했다. 37같이 딱나눠 떨어지지 않을 경우와 36같이 딱 나눠떨어질 경우를 말이다. 첫번째, 딱 나눠떨어지지 않을 경우 입력한 값의 1/2만큼 제곱을..