Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C++

Maximum points of intersection n circles in C++


ในบทช่วยสอนนี้ เราจะพูดถึงโปรแกรมหาจุดตัดสูงสุดของ n วงกลม

เราจะได้รับจำนวนวงกลม งานคือหาจำนวนจุดตัดสูงสุดที่จำนวนวงกลมที่กำหนดสามารถตัดกันได้

ตัวอย่างโค้ด

#include <bits/stdc++.h>
using namespace std;

int intersection(int n) {
    return n * (n - 1);
}

int main() {
    cout << intersection(3) << endl;
    return 0;
}

เอาต์พุต

6