BOJ - 9094 - 수학적 호기심

Updated:

import sys

def solution():
    T = int(sys.stdin.readline())
    for i in range(T):
        n, m = map(int, sys.stdin.readline().split())
        cnt = 0
        for a in range(1, n):
            for b in range(a + 1, n):
                if (a * a + b * b + m) // (a * b) == (a * a + b * b + m) / (a * b):
                    cnt += 1
        print(cnt)
solution()

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

Categories:

Updated:

Leave a comment