当前位置:网站首页>[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++];
}
边栏推荐
- AI遮天传 ML-集成学习
- URL跳转漏洞
- 【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用,虚拟磁盘文件丢失的数据恢复案例
- 【欧米读书会】谈谈元宇宙中的创作者经济:无限次元
- Week 17 free intrusion pointer exercise - output maximum
- Open source kaggle cat and dog data set -- used in classic CNN classification practice
- the loss outweighs the gain! Doctors cheated 2.1 million yuan and masters cheated 30000 yuan of talent subsidies, all of which were sentenced!
- 6-19漏洞利用-nsf获取目标密码文件
- 徽商期货网上开户安全吗?开户办理流程是怎样的?
- 【机器学习】Mean Shift原理及代码
猜你喜欢

JS closure simulates private variable interview questions and immediately executes function Iife

Coscon'22 city / school / institution producer solicitation order

来吧开发者!不只为了 20 万奖金,试试用最好的“积木”来一场头脑风暴吧!...

天翼云Web应用防火墙(边缘云版)支持检测和拦截Apache Spark shell命令注入漏洞

Performance tuning bugs emerge in endlessly? These three documents can easily handle JVM tuning

浅析接口测试

AI zhetianchuan DL regression and classification

Gan (generative adversarial network, GaN) generative countermeasure network

JS recursive Fibonacci sequence deep cloning

JS function scope variables declare that the variables that promote the scope chain without VaR are global variables
随机推荐
kudu设计-tablet
图解用户登录验证流程,写得太好了!
On the growth of data technicians
A detailed explanation of throughput, QPS, TPS, concurrency and other high concurrency indicators
Tree DP problem
2.1.2 synchronization always fails
VS Code 格式化后 自动让函数名后有空格
SQL中去去重的三种方式
Spark unified memory partition
Is it really safe and reliable to exempt five in case of opening an account in a stock company
[cloud native kubernetes actual combat] kubeopertor installation tutorial
如何组装一个注册中心?
AI zhetianchuan DL regression and classification
AI遮天传 DL-回归与分类
常用超好用正则表达式!
Open source kaggle cat and dog data set -- used in classic CNN classification practice
Redisdesktopmanager removes the upgrade prompt
uni-app
(25) top level menu of blender source code analysis blender menu
A collection of commonly used shortcut keys for office software