N个点可以将圆划分成几个区域

B站上讲的超好的视频

欧拉示性数公式:V-E-F=2

V:顶点数;

E:边数;

F:被划分区域数;

#include<bits/stdc++.h>

using namespace std;

long long C(int n, int m)
{
    long long s=1;
    if(n < m)
        s=0;
    else if (n == m || m == 0)
        s=1;
    else
        for(int i=1; i<=m; i++)
            s = s * (n - i + 1) / i;

     return s;
 }

int main(){
    int n;
    while(cin>>n){
        cout<<C(n,4)+C(n,2)+1<<endl;
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_40679299/article/details/81161838