| Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|---|
| 39160 | LYLAKIOI | 【S】T2 | C++ | 通过 | 100 | 449 MS | 248 KB | 1105 | 2025-12-22 19:32:01 |
#include<bits/stdc++.h> #define up(i,l,r) for(int i=(l);i<=(r);++i) #define down(i,l,r) for(int i=(l);i>=(r);--i) #define pi pair<int,int> #define p1 first #define p2 second #define m_p make_pair #define pb push_back #define eb emplace_back using namespace std; typedef long long ll; inline ll read(){ ll x=0;short t=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); return x*t; } const int maxn=1e6+10,mod=1e9+7; int n,m; inline int qp(int a,int b){ int res=1; while(b){ if(b&1)res=res*1ll*a%mod; a=a*1ll*a%mod;b>>=1; }return res; } void slv(){ n=read(),m=read(); int s1=1,s2=1,s3=m,res=0; up(i,0,m-1){ res=(res+s1*1ll*s2%mod*1ll*s3%mod*1ll*qp(i+1,mod-2))%mod; s1=s1*1ll*(n-i)%mod*1ll*qp(i+1,mod-2)%mod; s2=s2*1ll*(n-i-1)%mod*1ll*qp(i+1,mod-2)%mod; s3=s3*1ll*(m-i-1)%mod; } cout<<res; } int main(){ //freopen("life.in","r",stdin),freopen("life.out","w",stdout); slv(); return 0; }