题意
求以xx结尾的长度为ll的不下降正整数数列一共有多少个。对911451407911451407取模输入描述
本题有多组数据。
第一行一个正整数TT,表示数据组数。
对于每组数据:两个用空格隔开的整数l, xl,x。
输出描述
T行,每行一个答案。
解析
看了隔壁大佬的博客大佬博客打表找规律 最后得出递推式
代码
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod = 911451407;
const int maxn = 100005;
ll fac[2000005];
ll qpow(ll x,ll y){
x %= mod;
ll ans = 1;
while(y){
if(y&1) ans = ans*x%mod;
x = x*x%mod;
y >>= 1;
}
return ans;
}
int main(void){
ios::sync_with_stdio(false);
fac[0] = 1;
for(int i = 1 ; i < 2000005 ; ++i) fac[i] = fac[i-1]*i%mod;
int t;
cin>>t;
while(t--){
ll l,x;
cin>>l>>x;
ll ans = fac[x+l-2]*qpow(fac[x-1],911451405)%mod;
ans = ans*qpow(fac[l-1],911451405)%mod;
cout<<ans<<endl;
}
}

京公网安备 11010502036488号