POJ 2519
又是一个水题?? 不过还是弄是很久... 在蒟蒻的路上越走越远 , 好了讲题
新生晚会
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 13433 Accepted Submission(s): 4641
每组数据包含两个整数N(来报名的人数,1<=N<=30),M(节目需要的人数0<=M<=30)
3 2
5 3
4 4
3 6
8 0
10
1
0
1
#include<iostream>
#include<algorithm>
using namespace std; long long g(int n, int m){
if(n < m) return ;
else if(m == || n == m) return ;
else{
m = max(m, n-m);
long long ans = ;
for(int i=; i<=m; i++) ans = ans*(n-i+)/i;
return ans;
}
} int main(){
int T;
cin >> T;
while(T--){
int m, n;
cin >> m >> n;
cout << g(m, n) << endl;
} return ;
}
POJ 2519的更多相关文章
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- POJ 2255. Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11939 Accepted: 7493 De ...
- POJ 2752 Seek the Name, Seek the Fame [kmp]
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17898 Ac ...
- poj 2352 Stars 数星星 详解
题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...
随机推荐
- caffe_实战之两个简单的例子(物体分类和人脸检测)
一.物体分类: 这里使用的是caffe官网中自带的例子,我这里主要是对代码的解释~ 首先导入一些必要的库: import caffe import numpy as np import matplot ...
- 离线安装 Python 2.7, paramiko 和 tornado
无非就是离线安装, 步骤比较繁琐, 记录一下. 需求很简单, 一个离线安装的 Python, 能跑 tornado 和 paramiko 1. 离线安装 Python 2.7 .tgz cd Pyth ...
- 安装Java的IDE Eclipse时出现java.net.SocketException,出现错误Installer failed,show.log
ERROR: org.eclipse.equinox.p2.transport.ecf code=1002 Unable to read repository at http://download.e ...
- List提取相同元素
List<int> currentList = Cls_Data.SoruceDataIntses[key]; preList = currentList.Intersect(preLis ...
- 请慎用java的File#renameTo(File)方法
转载地址:http://xiaoych.iteye.com/blog/149328 以前我一直以为File#renameTo(File)方法与OS下面的 move/mv 命令是相同的,可以达到改名.移 ...
- linux常用命令备忘
scp使用非默认端口 scp -P port username@.....IP:/dir 要拷贝到的地方
- css中“~”和“>”是什么意思?
css中"~"是: 为所有相同的父元素中位于 p 元素之后的所有 ul 元素设置背景: p~ul{ background:#ff0000; } <p>快乐生活&l ...
- git使用入门
添加文件到git仓库 git add readme.txt git commit -m "write a readme file" 查询工作区状态 git status 查询修改内 ...
- C++ 系列:编译 boost
Copyright © 1900-2016, NORYES, All Rights Reserved. http://www.cnblogs.com/noryes/ 欢迎转载,请保留此版权声明. -- ...
- Mac下没有权限启动tomcat的解决办法
问题描述 在Mac中通过./startup.sh执行启动脚本文件,启动tomcat时报如下错误: -bash: ./startup.sh: Permission denied 解决方法 错误信息说明了 ...