FZU 1876 JinYueTuan(排列组合)
Description
Now, do you know what it’s? Yeah , O(∩_∩)O~ , It is the game called JinYueTuan. chjing plays it very often years ago. I promise you would like it too. Now I want to introduce it to you. Maybe you have already known it clearly. Just be patient.
JinYueTuan is a famous online game which has been in vogue for a long time. Since it is so exciting a game that a large number of players put themselves in it . Only seven keys on the keyboard will be used in games, each key are assigned to one of the seven sound tracks. During the game, a series of notes may fall in each sound track irregularly. When notes fall down in one sound track, player should press the assigned key at once. If so, then got a “Cool”, or get “Miss” otherwise. You should press the key when the note is almost disappeared at the bottom of the window. If you press the key too early, you will miss the note. There will be a song or some kind of music played when you are playing the game. So you will feel you are a pianist. As you pass a low level .the notes will be more and the speed the notes fall will be very high. And the game will be more exciting .There are a lot of cows who play this game very well. If you have a chance to watch them playing, you would say ‘orz’ from your heart. But as a programmer, we would admire people who write this game more. Here comes the problem.
If you are assigned write a game similar to this game. If there are n different sound tracks and m different notes. How many different ways can you arrange the notes to fall.
Input
Output
Sample Input
Sample Output
Hint

We only care about the figure when the notes are piled up. So please ignore the sequence of the notes falling in different sound tracks.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <algorithm>
#define root 1,n,1
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define lr rt<<1
#define rr rt<<1|1
using namespace std; typedef long long LL;
const int inf = 1e9+;
const double PI = acos(-1.0);
const double eps = 1e- ;
const int N = ;
LL n , m , p ;
int main()
{
#ifdef LOCAL
freopen("in.txt","r",stdin);
#endif // LOCAL
ios::sync_with_stdio(false);
while( cin >> n >> m >> p ) {
LL res = ;
for( int i = n + m - ; i >= n ; --i ) {
res *= i ; res %= p ;
if( !res ) break ;
}
cout << res << endl;
}
}
FZU 1876 JinYueTuan(排列组合)的更多相关文章
- FOJ (FZU) 1476 矩形的个数 排列组合。
http://acm.fzu.edu.cn/problem.php?pid=1476 Problem Description 在一个3*2的矩形中,可以找到6个1*1的矩形,4个2*1的矩形3个1* ...
- 学习sql中的排列组合,在园子里搜着看于是。。。
学习sql中的排列组合,在园子里搜着看,看到篇文章,于是自己(新手)用了最最原始的sql去写出来: --需求----B, C, F, M and S住在一座房子的不同楼层.--B 不住顶层.C 不住底 ...
- .NET平台开源项目速览(11)KwCombinatorics排列组合使用案例(1)
今年上半年,我在KwCombinatorics系列文章中,重点介绍了KwCombinatorics组件的使用情况,其实这个组件我5年前就开始用了,非常方便,麻雀虽小五脏俱全.所以一直非常喜欢,才写了几 ...
- 【原创】开源.NET排列组合组件KwCombinatorics使用(三)——笛卡尔积组合
本博客所有文章分类的总目录:本博客博文总目录-实时更新 本博客其他.NET开源项目文章目录:[目录]本博客其他.NET开源项目文章目录 KwCombinatorics组件文章目录: 1. ...
- 【原创】开源.NET排列组合组件KwCombinatorics使用(二)——排列生成
本博客所有文章分类的总目录:本博客博文总目录-实时更新 本博客其他.NET开源项目文章目录:[目录]本博客其他.NET开源项目文章目录 KwCombinatorics组件文章目录: 1. ...
- 【原创】开源.NET排列组合组件KwCombinatorics使用(一)—组合生成
本博客所有文章分类的总目录:本博客博文总目录-实时更新 本博客其他.NET开源项目文章目录:[目录]本博客其他.NET开源项目文章目录 KwCombinatorics组件文章目录: 1. ...
- hdu1521 排列组合(指数型母函数)
题意: 有n种物品,并且知道每种物品的数量ki.要求从中选出m件物品的排数. (全题文末) 知识点: 普通母函数 指数型母函数:(用来求解多重集的排列问题) n个元素,其中a1,a2, ...
- [leetcode] 题型整理之排列组合
一般用dfs来做 最简单的一种: 17. Letter Combinations of a Phone Number Given a digit string, return all possible ...
- 排列组合算法(PHP)
用php实现的排列组合算法.使用递归算法,效率低,胜在简单易懂.可对付元素不多的情况. //从$input数组中取$m个数的组合算法 function comb($input, $m) { if($m ...
随机推荐
- spring(一):spring的基础以及组件
spring简介 spring是一种开源轻量级框架,是为了解决企业应用程序复杂性而创建的 spring是企业应用开发的“一站式”框架,致力于为javaEE应用的各层(表现层.业务层.持久层)开发提供解 ...
- zabbix入门之定义触发器
zabbix入门之定义触发器 触发器的概念 触发器的定义:界定某特定的item 采集到数据的非合理区间或非合理状态.通常为逻辑表达式. 逻辑表达式(阈值):通常用于定义数据的不合理区间,其结果如下: ...
- python常用函数 B
B bin(int) 将整数x转换为二进制字符串,如果x不为Python中int类型,x必须包含方法__index__()并且返回值为integer. 例子:
- weblogic启动脚本01
DATE=`date +%Y%m%d%H%M%S` user=`whoami` logDir=/app/logs/sguap_admin #启动日志存放路径sguap是例子系统简称# logDestd ...
- ZYNQ跑系统 系列(二) petalinux方式移植linux
三.搭建petalinux工程 0.定位目录 先在shell中找一个准备存放工程的地方,(我的是home/hlf/PRO),命令行cd home/hlf/PRO 1.定位编译链 根据安装p ...
- 浅析HTTP代理原理
代理服务器是HTTP协议中一个重要的组件,发挥着重要的作用. 关于HTTP代理的文章有很多,本文不再赘述,如果不清楚的可以看一下 HTTP代理的基础知识. 本文主要介绍代理的事例,分析一个真实的案例来 ...
- webdriver原理
WebDriver 安装C/S构架设计的: 代码(客户端)--->驱动(解析代码)----->浏览器(服务端) 代码通过http请求发给浏览器驱动,驱动解析代码把他们发给浏览器,浏览器执行 ...
- 51nod 1605:棋盘问题
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1605 题目中最有用的点其实还是x必为奇数 #include& ...
- Activity(工作流-1)
1.activity自带数据表的含义(23张表) (1)资源库流程规则表 1)act_re_deployment 部署信息表 2)act_re_model 流程设计模型部署表 3)act_re_pr ...
- Python3解leetcode Lowest Common Ancestor of a Binary Search Tree
问题描述: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in ...