Codeforces--630H--Benches(组合数)
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
5
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(组合数)的更多相关文章
- (水题)Codeforces - 630H - Benches
		
https://codeforces.com/problemset/problem/630/H 又一个组合数学的问题,我们先考虑在 $n$ 列中选出 $5$ 列来放椅子,然后对第一列有 $n$ 种放法 ...
 - Codeforces 100548F - Color (组合数+容斥)
		
题目链接:http://codeforces.com/gym/100548/attachments 有n个物品 m种颜色,要求你只用k种颜色,且相邻物品的颜色不能相同,问你有多少种方案. 从m种颜色选 ...
 - codeforces 630H (组合数学)
		
H - Benches Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit S ...
 - Codeforces 521C (经典)组合数取模【逆元】
		
<题目链接> <转载于 >>> > 题目大意:给出一串n个数字,让你在这串数字中添加k个 ' + ' 号(添加后表达式合法),然后所有拆分所得的所有合法表达 ...
 - codeforces 691F(组合数计算)
		
Couple Cover, a wildly popular luck-based game, is about to begin! Two players must work together to ...
 - Educational Codeforces Round 26 F. Prefix Sums 二分,组合数
		
题目链接:http://codeforces.com/contest/837/problem/F 题意:如题QAQ 解法:参考题解博客:http://www.cnblogs.com/FxxL/p/72 ...
 - Codeforces 893E Counting Arrays:dp + 线性筛 + 分解质因数 + 组合数结论
		
题目链接:http://codeforces.com/problemset/problem/893/E 题意: 共q组数据(q <= 10^5),每组数据给定x,y(x,y <= 10^6 ...
 - Codeforces 869C The Intriguing Obsession:组合数 or dp
		
题目链接:http://codeforces.com/problemset/problem/869/C 题意: 红色.蓝色.紫色的小岛分别有a,b,c个. 你可以在两个不同的岛之间架桥,桥的长度为1. ...
 - Codeforces 785 D.Anton and School - 2(组合数处理)
		
Codeforces 785 D.Anton and School - 2 题目大意:从一串由"(",")"组成的字符串中,找出有多少个子序列满足:序列长度为偶 ...
 - Codeforces 131C . The World is a Theatre(打表组合数)
		
题目链接:http://codeforces.com/contest/131/problem/C 大意就是有n个男孩,m个女孩,从男孩中选不少于4个男孩,女孩中选不少于1个女孩,组成人数为t的队伍,问 ...
 
随机推荐
- html5——渐变
			
线性渐变 <style> div { width: 700px; height: 100px; /*方向:从右向左*/ /*起始颜色:黄色*/ /*终止颜色:绿色*/ background ...
 - [Windows Server 2003] 安装PHP+MySQL方法
			
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:PHP+MyS ...
 - appium 使用send_keys方法时报错: driver.find_element_by_id("com.hmkx.zgjkj:id/layout_search_bar_input").send_keys("123")
			
新手 使用send_keys方法时一直报错,上网查这个方法的用法,看着大家都是这么写的啊,后来直接搜索 报错信息,搜索结果的针对性就清楚多了. 原来是seleium版本太高导致的问题. 可以先在cmd ...
 - Cesium学习笔记(五):3D 模型 (http://blog.csdn.net/umgsoil/article/details/74572877)
			
Cesium支持3D模型,包括关键帧动画,皮肤的改变还有单个节点的选择等,Cesium还提供了了一个基于网络的工具,将COLLADA模型转换为glTF,方便和优化模型添加 还记得我们在实体添加的时候添 ...
 - ARX自定义实体
			
本文介绍了构造自定义实体的步骤.必须继承的函数和必须注意的事项 1.新建一个从AcDbEntity继承的类,如EntTest,必须添加的头文件: "stdarx.h"," ...
 - CPU 指令集(Instruction Set Architecture, ISA)
			
本文摘自网络 概念 指令集是存储在CPU内部,对CPU运算进行指导和优化的硬程序,用来引导CPU进行加减运算和控制计算机操作系统的一系列指令集合.拥有这些指令集,CPU就可以更高效地运行.系统所下达的 ...
 - 【XSY3413】Lambda - 造计算机初步——邱奇-图灵论题与lambda演算
			
题意: 关于邱奇-图灵论题的一点思考 这道题起源于计算机科学史上一个非常著名的问题——邱奇-图灵论题,这个论题是可计算性理论的基石,关于它的思考与证明几乎贯穿了整个计算机科学史,涵盖了数学.算法理论. ...
 - js-2018-11-01 关于break和continue语句
			
1.label语句 语法:label: statement 加标签语句一般都要与for语句等循环语句配合使用. 2.break语句 立即退出循环,强制执行循环后面的语句. 3.continue语句 立 ...
 - 回溯法、DFS
			
回溯法 为了求得问题的解,先选择某一种可能情况向前探索,在探索过程中,一旦发现原来的选择是错误的,就退回上一步重新选择条件,继续向前探索,如此反复进行,直至得到解或证明无解. DFS DFS模板 vo ...
 - CentOS 7.2安装配置Vsftp服务器
			
一.配置防火墙,开启FTP服务器需要的端口 CentOS 7.2默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...