当前位置:网站首页>[Day2] cinema ticket
[Day2] cinema ticket
2022-07-26 17:50:00 【SSL_ GYX】
cinema ticket

Their thinking
The easy recursive formula is f i , j = f i − 1 , j + f i , j − 1 f_{i,j}=f_{i-1,j}+f_{i,j-1} fi,j=fi−1,j+fi,j−1 .
When known i = = j i==j i==j , f i , j f_{i,j} fi,j For the number of catterland i i i term .
You can push a n s = ( n + 1 − m ) ( n + m ) ! m ! ( n + 1 ) ! ans=\frac{(n+1-m)(n+m)!}{m!(n+1)!} ans=m!(n+1)!(n+1−m)(n+m)! .
High precision is needed .
code
#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
struct num{
int s[10010];
num operator *(int x)
{
num t={
0};
int lst=0;
for(int i=10000;i;i--)
{
t.s[i]=s[i]*x+lst;
lst=t.s[i]/10;
t.s[i]%=10;
}
return t;
}
num operator /(int x)
{
num t={
0};
int lst=0;
for(int i=1;i<=10000;i++)
lst=lst*10+s[i],t.s[i]=lst/x,lst%=x;
return t;
}
num operator -(num x)
{
num t={
0};
for(int i=10000;i;i--)
{
if(s[i]>=x.s[i])
t.s[i]=s[i]-x.s[i];
else
t.s[i]=s[i]+10-x.s[i],s[i-1]--;
}
return t;
}
}a,b;
int main()
{
cin>>n>>m;
int i,j;
b.s[10000]=1;
for(i=1,j=n+m;i<m;i++,j--)
b=b*j,b=b/i;
a=b*j,a=a/i;
num ans=a-b;
i=0;
while(!ans.s[i]) i++;
while(i<=10000) cout<<ans.s[i++];
}
边栏推荐
- Centos安装docker以及mysql和redis环境
- How to use align regexp to align userscript meta information
- What are the popular technologies in 2022?
- 图扑 3D 可视化国风设计 | 科技与文化碰撞炫酷”火花“
- 【机器学习】Mean Shift原理及代码
- 长征证券开户安全吗?
- Come on developer! Not only for the 200000 bonus, try the best "building blocks" for a brainstorming!
- A detailed explanation of throughput, QPS, TPS, concurrency and other high concurrency indicators
- Cloud rendering volume cloud [theoretical basis and implementation scheme]
- 图解用户登录验证流程,写得太好了!
猜你喜欢

Interview with celebrities | open source is a double-edged sword for security -- Wei Jianfan, author of the Chinese translation of cathedral and market

【集训Day3】Reconstruction of roads

the loss outweighs the gain! Doctors cheated 2.1 million yuan and masters cheated 30000 yuan of talent subsidies, all of which were sentenced!

(24)Blender源码分析之顶层菜单显示代码分析

CCS TM4C123新建工程

Asemi rectifier bridge kbpc2510, kbpc2510 parameters, kbpc2510 specifications

We were tossed all night by a Kong performance bug

AI遮天传 DL-多层感知机

6-19 vulnerability exploitation -nsf to obtain the target password file

(25) top level menu of blender source code analysis blender menu
随机推荐
CCS tm4c123 new project
Asemi rectifier bridge kbpc2510, kbpc2510 parameters, kbpc2510 specifications
Spark unified memory partition
Tree DP problem
(25) top level menu of blender source code analysis blender menu
【云原生之kubernetes实战】安装kubeopertor教程
Mondriaans‘s Dream(状态压缩DP)
(24)Blender源码分析之顶层菜单显示代码分析
Heavy! The 2022 China open source development blue book was officially released
# MySQL 七种连接方式图解
Interview with celebrities | open source is a double-edged sword for security -- Wei Jianfan, author of the Chinese translation of cathedral and market
点击劫持攻击
Pytest (mind map)
kudu设计-tablet
ACL experiment demonstration (Huawei router device configuration)
国际象棋机器人夹断7岁男孩手指,原因是「棋手违反安全规则」?
数据库使用psql及jdbc进行远程连接,不定时自动断开的解决办法
Kudu design tablet
【云原生】 iVX 低代码开发 引入腾讯地图并在线预览
Basic select statement