标签:
【题目大意】
1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #include<map> 5 #define ll long long 6 using namespace std; 7 const int mod=1e9+7; 8 ll n,m; 9 10 ll pow(ll x,ll k) 11 { 12 ll ret=1; 13 for(int i=k;i;i>>=1,x=x*x%mod) 14 if(i&1) ret=ret*x%mod; 15 return ret; 16 } 17 18 19 void solve() 20 { 21 scanf("%lld%lld",&n,&m); 22 if(n>m) swap(n,m); 23 m%=mod; 24 ll ans=m+1; 25 26 ll x=1; 27 for(int i=1;i<=n;i++) 28 { 29 x=(x*(m+i))%mod; 30 x=(x*pow(i,mod-2))%mod; 31 ans=(ans+x)%mod; 32 } 33 printf("%lld\n",ans); 34 35 } 36 37 int main() 38 { 39 solve(); 40 return 0; 41 }
标签:
原文地址:http://www.cnblogs.com/iiyiyi/p/5920480.html