各位大佬请教一下这个有什么问题吗
  • 板块P2181 对角线
  • 楼主jjnwer
  • 当前回复4
  • 已保存回复4
  • 发布时间2021/2/19 09:44
  • 上次更新2023/11/5 03:05:04
查看原帖
各位大佬请教一下这个有什么问题吗
438082
jjnwer楼主2021/2/19 09:44
#include<iostream>

using namespace std;

long long fac(int x)
{
    if(x==0) return 1;
    else if(x==1) return 1;
    else return x*fac(x-1);
}

long long DiagonalIntersection(int n)
{
    return (fac(n))/(fac(n-4)*fac(4));
}

int main(void)
{
    int n;
    cin>>n;

    if(n<=3) cout<<0;
    else
    {
        cout<<DiagonalIntersection(n);
    }

    return 0;
}
2021/2/19 09:44
加载中...