이 튜토리얼에서는 n개의 원의 최대 교차점을 찾는 프로그램에 대해 논의할 것입니다.
이를 위해 우리는 원의 수를 제공받을 것입니다. 우리의 임무는 주어진 원이 만나는 최대 교차 수를 찾는 것입니다.
예시
#include <bits/stdc++.h>
using namespace std;
//returning maximum intersections
int intersection(int n) {
return n * (n - 1);
}
int main() {
cout << intersection(3) << endl;
return 0;
} 출력
6