当前位置:网站首页>[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++];
}
边栏推荐
- Application of machine vision in service robot
- Just this time! Talk about the technical solutions of distributed system in detail
- 长征证券开户安全吗?
- Several ways to resolve hash conflicts
- 解决哈希冲突的几种方式
- Definition of graph traversal and depth first search and breadth first search (I)
- pip安装模块,报错
- 跨站点请求伪造(CSRF)
- 性能调优bug层出不穷?这3份文档轻松搞定JVM调优
- [machine learning] principle and code of mean shift
猜你喜欢

【集训Day2】Torchbearer

SQL中去去重的三种方式

2019 popularization group summary

跨站点请求伪造(CSRF)

Heavy! The 2022 China open source development blue book was officially released

AI zhetianchuan ml integrated learning

大咖访谈 | 开源对安全是双刃剑——《大教堂与集市》中文译本作者卫剑钒

Week 17 free intrusion pointer exercise - output maximum

236. 二叉树的最近公共祖先
![[cloud native] IVX low code development was introduced into Tencent map and previewed online](/img/f1/40ca06bf65fbc0097f5b61ec7d2509.png)
[cloud native] IVX low code development was introduced into Tencent map and previewed online
随机推荐
数据库使用psql及jdbc进行远程连接,不定时自动断开的解决办法
The chess robot broke the finger of a 7-year-old boy because "the chess player violated safety rules"?
Tensor operation in pytoch
如何组装一个注册中心?
Pytest(思维导图)
如何快速使用 ELisp 进行插件编写
Come on developer! Not only for the 200000 bonus, try the best "building blocks" for a brainstorming!
如何使用 align-regexp 对齐 userscript 元信息
点击劫持攻击
Definition of graph traversal and depth first search and breadth first search (I)
【集训Day2】Sculpture
#夏日挑战赛# OpenHarmony基于JS实现的贪吃蛇
【集训Day1】 Dwarves line up
简述CUDA镜像构建
[machine learning] principle and code of mean shift
SQL中去去重的三种方式
Machine learning - what are machine learning, supervised learning, and unsupervised learning
二层管理型交换机如何设置IP
ACL实验演示(Huawei路由器设备配置)
【集训Day3】Reconstruction of roads