Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- Incognito
- Digital Forensics
- 인코그니토
- Database
- CTF
- 수학
- writeup
- wargame
- 써니나타스
- php
- Web
- Forensics
- HackCTF
- N0Named
- 사칙연산
- 그리디 알고리즘
- 백준
- Network
- C
- 정렬
- Python
- Web Hacking
- 문자열
- xcz.kr
- MySQL
- SuNiNaTas
- 구현
- Text
- misc
- cryptography
Archives
- Today
- Total
보안을 그리다, 훈이
[Baekjoon/Python3] 1977번 완전제곱수 본문
[Baekjoon/Python3] 1977번 완전제곱수
1977번: 완전제곱수
M과 N이 주어질 때 M이상 N이하의 자연수 중 완전제곱수인 것을 모두 골라 그 합을 구하고 그 중 최솟값을 찾는 프로그램을 작성하시오. 예를 들어 M=60, N=100인 경우 60이상 100이하의 자연수 중 완
www.acmicpc.net
import math as h
m = int(input())
n = int(input())
nums = []
for i in range(h.ceil(h.sqrt(m)), h.floor(h.sqrt(n) + 1)):
nums.append(pow(i, 2))
if len(nums) == 0:
print(-1)
else:
print(sum(nums), nums[0], sep='\n')
'Programming > Python & Data Structures' 카테고리의 다른 글
[Baekjoon/Python3] 2010번 플러그 (0) | 2020.12.03 |
---|---|
[Baekjoon/Python3] 1978번 소수 찾기 (0) | 2020.12.03 |
[Baekjoon/Python3] 1934번 최소공배수 (0) | 2020.12.03 |
[Baekjoon/Python3] 1924번 2007년 (0) | 2020.12.03 |
[Baekjoon/Python3] 1871번 좋은 자동차 번호판 (0) | 2020.12.03 |
Comments