H -
Benches

Crawling in process...
Crawling failed
Time Limit:500MS    
Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

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
远看还以为是阶乘,--||然而n可以到一百,看了题才知道是组合数,东西向,南北向的路各n条,相互垂直的两条路一定会相交,形成了n*n个路口,现在5张长凳,
把凳子放到路口,并且每条路只能出现一张凳子,那摩我们就要从南北向,东西向的路中各挑出5条,然后,,,,,,
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
__int64 C(__int64 m,__int64 n)
{
__int64 ans=1;
__int64 num=1;
while(n--)
{
ans*=(m-n);
ans/=num;
num++;
}
return ans;
}
int main()
{
__int64 n;
while(cin>>n)
{
cout<<120*C(n,5)*C(n,5)<<endl;
}
return 0;
}

Codeforces--630H--Benches(组合数)的更多相关文章

  1. (水题)Codeforces - 630H - Benches

    https://codeforces.com/problemset/problem/630/H 又一个组合数学的问题,我们先考虑在 $n$ 列中选出 $5$ 列来放椅子,然后对第一列有 $n$ 种放法 ...

  2. Codeforces 100548F - Color (组合数+容斥)

    题目链接:http://codeforces.com/gym/100548/attachments 有n个物品 m种颜色,要求你只用k种颜色,且相邻物品的颜色不能相同,问你有多少种方案. 从m种颜色选 ...

  3. codeforces 630H (组合数学)

    H - Benches Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit S ...

  4. Codeforces 521C (经典)组合数取模【逆元】

    <题目链接> <转载于 >>>  > 题目大意:给出一串n个数字,让你在这串数字中添加k个 ' + ' 号(添加后表达式合法),然后所有拆分所得的所有合法表达 ...

  5. codeforces 691F(组合数计算)

    Couple Cover, a wildly popular luck-based game, is about to begin! Two players must work together to ...

  6. Educational Codeforces Round 26 F. Prefix Sums 二分,组合数

    题目链接:http://codeforces.com/contest/837/problem/F 题意:如题QAQ 解法:参考题解博客:http://www.cnblogs.com/FxxL/p/72 ...

  7. Codeforces 893E Counting Arrays:dp + 线性筛 + 分解质因数 + 组合数结论

    题目链接:http://codeforces.com/problemset/problem/893/E 题意: 共q组数据(q <= 10^5),每组数据给定x,y(x,y <= 10^6 ...

  8. Codeforces 869C The Intriguing Obsession:组合数 or dp

    题目链接:http://codeforces.com/problemset/problem/869/C 题意: 红色.蓝色.紫色的小岛分别有a,b,c个. 你可以在两个不同的岛之间架桥,桥的长度为1. ...

  9. Codeforces 785 D.Anton and School - 2(组合数处理)

    Codeforces 785 D.Anton and School - 2 题目大意:从一串由"(",")"组成的字符串中,找出有多少个子序列满足:序列长度为偶 ...

  10. Codeforces 131C . The World is a Theatre(打表组合数)

    题目链接:http://codeforces.com/contest/131/problem/C 大意就是有n个男孩,m个女孩,从男孩中选不少于4个男孩,女孩中选不少于1个女孩,组成人数为t的队伍,问 ...

随机推荐

  1. JS——select标签

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  2. servlet得到web应用路径

    package context; import java.io.IOException; import javax.servlet.ServletContext; import javax.servl ...

  3. 惊了!!! 小白零基础学java (月薪过万是你的梦想嘛) 手把手教学 就怕你不动手【二十五】第二章【初识MySQL】

    初识MySQL1. 了解主流的数据库和数据库分类1.1 数据库概念数据库:按照数据结构来组织.存储和管理数据的一种建立在计算机存储设备上的仓库. 数据库的优势: 1. 可以持久化存储大量的数据.方便我 ...

  4. scrapy框架的日志等级和请求传参, 优化效率

    目录 scrapy框架的日志等级和请求传参, 优化效率 Scrapy的日志等级 请求传参 如何提高scripy的爬取效率 scrapy框架的日志等级和请求传参, 优化效率 Scrapy的日志等级 在使 ...

  5. windows下db2的一些使用心得(不含安装)

    1.安装完成后开始菜单栏里会有一个 DB2 Command Window - Administrator 打开这个命令窗口 2.db2 db2,启动 3.list databse directory ...

  6. play snake on linux

    在写完超Low的windows上的贪吃蛇后 被人吐槽了几个方面: 1.界面真的Low,开始,结束,游戏中,都太简陋了... 2.每次都清屏在输出字符矩阵的解决方案...太晃眼了 3.一个BUG,为了解 ...

  7. Maven学习总结(28)——Maven+Nexus+Myeclipse集成

    Maven简介 Maven 是一个基于项目对象模型(POM)的,提倡约定优于配置(ConventionOver Configuration)的,跨平台的项目管理和构建自动化工具. 首先它是一个优秀的构 ...

  8. GSM/GPRS/EDGE/WCDMA/HSDPA/HSUPA--辨析

    一 . 网络制式 --  语音通话 GSM  CDMA 1X WCDMA TD-SCDMA CDMA EV-DO TD-LTE FDD-LTE 二.数据传输制式 -- 上网 GPRS EDGE HSD ...

  9. linux系统监控:记录用户操作轨迹,谁动过服务器

    1.前言 我们在实际工作当中,都碰到过误操作.误删除.误修改过配置文件等等事件.对于没有堡垒机的公司来说,要在linux系统上深究到底谁做过配置文件的修改.做过误删除是很头疼的事情,特别是遇到删库跑路 ...

  10. hdu_1018_Big Number_201308191556

    Big NumberTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total S ...