[수학/브루트포스] 백준 13225 Divisors - 파이썬(Python)


[수학/브루트포스] 백준 13225 Divisors - 파이썬(Python)

[ Contents ] 1. 문제 (링크 참조) 13225번: Divisors For each integer n, print a line with the number n itself, a space and the number of divisors. www.acmicpc.net 2. 문제 풀이 정수 N이 주어집니다. 정수 N의 약수의 개수를 구합니다. 3. 코드 n = int(input()) for _ in range(n): c = int(input()) res = 0 for i in range(1, c+1): if c % i == 0: res += 1 print(c, res) 단순히 1부터 n까지 나눠지는 수를 찾아 횟수를 셉니다.


원문링크 : [수학/브루트포스] 백준 13225 Divisors - 파이썬(Python)