首页 > 编程知识 正文

CodeForces 630H Benches组合数学,组合数学曹汝成第二版答案

时间:2023-05-06 14:50:20 阅读:232704 作者:2116

Benches Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit  Status

Description

The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections.

The city funded purchase of five benches. To make it seems that there are many benches it was decided to place them on as many paths as possible. Obviously this requirement is satisfied by the following scheme: each bench is placed on a cross of paths and each path contains not more than one bench.

Help the park administration count the number of ways to place the benches.

Input

The only line of the input contains one integer n (5 ≤ n ≤ 100) — the number of east to west paths and north to south paths.

Output

Output one integer — the number of ways to place the benches.

Sample Input

Input 5 Output

120

代码如下:

#include<stdio.h>int main(){int n,i,j;long long sum;while(scanf("%d",&n)!=EOF){sum=1;j=1;for(i=4;i>=0;i--){ sum*=(n-i)*(n-i); sum/=j; j++;}printf("%lldn",sum);}return 0;}

win7中qq截图快捷键是什么

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。