Skip to content

Conversation

@lkhyun
Copy link
Contributor

@lkhyun lkhyun commented Sep 10, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/1016

🧭 풀이 시간

60분

👀 체감 난이도

✏️ 문제 설명

min과 max 사이의 값에서 1보다 큰 제곱수로 나누어지지 않는 수의 개수를 출력.

🔍 풀이 방법

set
min이 1조까지고 max가 min과 최대 100만 차이라 대략 고려해야하는 제곱수가 100만개정도 됌. 그래서 다 구해놓고
제곱수 하나씩 순회하면서 제곱수 * i가 min에서 max 사이에 있는 경우 set에 넣음.
그리고 max - min +1 에서 set의 크기를 빼주면 됨.
제곱수로 늘려가며 나누니까 시그마 1 / i^2 이면 파이/6으로 수렴하니까
시간 복잡도가 O(N)이다.

⏳ 회고

제곱수가 아니어도 O(NlogN) 이다.

@lkhyun lkhyun self-assigned this Sep 10, 2025
@lkhyun lkhyun added the success 👍 해설을 보지 않고 풀었을 때 label Sep 10, 2025
@ShinHeeEul ShinHeeEul merged commit 3e4decb into main Sep 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants