728x90
반응형
#include <iostream>
#include <algorithm>
using namespace std;
/*
[백준 9094 c++ V] 수학적 호기심
문제:
접근1:
풀이:
*/
int cnt, n, m, t, a, b;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin >> t; //테스트 케이스 입력
while (t)
{
t--;
cnt = 0;
cin >> n >> m;
for (a = 1; a < n; a++) //1부터 n까지 하나하나 다 해본다.
{
for (b = a + 1; b < n; b++)
{
if (!((a * a + b * b + m) % (a * b))) //나눠서 나머지가 없으면 정수이므로 카운트해준다.
cnt++;
}
}
cout << cnt << endl;
}
}
반응형
'Algorithm_BOJ(백준) > 완전탐색(Brute Force)' 카테고리의 다른 글
[백준 16236 c++ V] 아기 상어 (0) | 2023.03.08 |
---|---|
[백준 15686 c++ V] 치킨 배달 (0) | 2023.03.07 |
[백준 10971 c++ VO] 외판원 순회 2 (0) | 2022.12.29 |
[백준 1535 c++ O] 안녕 (0) | 2022.12.29 |
[백준 15649 c++ OOO] N과 M (1) (0) | 2021.09.22 |