#include<cstdio>
typedef long long ll;
const ll mod=; ll feima(ll a,ll b)
{
ll c=;
while(b)
{
if(b&)
c=c*a%mod;
a=a*a%mod;
b=b>>;
}
return c;
}
ll C(ll a,ll b)
{
if(a<b) return ;
if(a==b) return ;
if(b>a-b) b=a-b;
ll ca=,cb=;
for(ll i=;i<b;i++)
{
ca=ca*(a-i)%mod;
cb=cb*(b-i)%mod;
}
return ca*feima(cb,mod-)%mod;
}
/*LL Lucas(LL n,LL m)
{
if(m==0) return 1;
return C(n%p,m%p)*Lucas(n/p,m/p)%p;
}*/
ll Lucas(ll n,ll m)
{
ll ans=;
while(n&&m&&ans)
{
ans=ans%mod*C(n%mod,m%mod)%mod;
n/=mod;
m/=mod;
}
return ans;
} int main()
{
ll n,m;
while(~scanf("%lld%lld",&n,&m))
printf("%lld\n",Lucas(m,n));
return ;
}

XDU 1032的更多相关文章

  1. sqlservr (708) 打开日志文件 C:\Windows\system32\LogFiles\Sum\Api.log 时出现错误 -1032 (0xfffffbf8)

    在windows server 2012 standard上新安装好的SQL Server 2014,查看错误日志,发现此报错 sqlservr (708) 打开日志文件 C:\Windows\sys ...

  2. Light OJ 1032 - Fast Bit Calculations(数学)

    题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1032 题目大意:一个十进制数变化为二进制,那么对于这个数,如果连着两个二进制位 ...

  3. 1032: [JSOI2007]祖码Zuma

    链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1032 Description 这是一个流行在Jsoi的游戏,名称为祖玛.精致细腻的背景,外加神 ...

  4. loj 1032 数位dp

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1032 思路:数位dp, 采用记忆化搜索, dp[pos][pre][have] 表示 ...

  5. 【转】[退役]纪念我的ACM——headacher@XDU

    转自:http://hi.baidu.com/headacher/item/5a2ce1d50609091b20e25022 退役了,是时候总结一下我ACM的生涯了.虽然很舍不得,但这段回忆很值得纪念 ...

  6. PAT乙级 1032. 挖掘机技术哪家强(20)

    1032. 挖掘机技术哪家强(20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 为了用事实说明挖掘机技术到底 ...

  7. [MySQL] SQL_ERROR 1032解决办法

    一.缘由: 在主主同步的测试环境,由于业务侧没有遵循同一时间只写一个点的原则,造成A库上删除了一条数据,B库上在同时更新这条数据. 由于异步和网络延时,B的更新event先到达A端执行,造成A端找不到 ...

  8. 1032 - A-B 组合数学

    http://www.ifrog.cc/acm/problem/1032 1032 - A-B Time Limit:1s Memory Limit:128MByte Submissions:680S ...

  9. hihocode ---1032

    #include<iostream> #include<cstring> #include<cstdio> using namespace std; + ; ]; ...

随机推荐

  1. hdu 1147:Pick-up sticks(基本题,判断两线段相交)

    Pick-up sticks Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  2. LR的响应时间与使用IE所感受时间不一致的讨论(摘抄补充)

    http://www.51testing.com/html/33/564333-865629.html 在做性能测试时,有时碰到这样一种情况,使用性能工具LR测试出来的响应时间比实际使用IE感受到的时 ...

  3. A mail sent to Google chromium.org Groups for Help

    Hi, I've ported Chromium M39 to 4.4 using WebView. The main modifications are: I changed AwContents: ...

  4. WinForm------如何修改PanelControl控件背景色

    方法: 如何修改panelcontrol背景色 this.bottomPanel.BorderStyle = BorderStyles.NoBorder; this.bottomPanel.Appea ...

  5. WPF进阶之接口(4):ICommand实现详解

    上一章WPF进阶之接口():INotifyPropertyChanged,ICommand中我们遗留了几个问题,我将在本节中做出解释.在详细解释ICommand实现之前,我们现在关注一下什么是:弱引用 ...

  6. vue2.0非父子间进行通讯

    在vue中,父组件向之组件通讯使用的是props,子组件向父组件通讯使用的是$emit+事件,那非父子间的通讯呢,在官方文档上只有寥寥数笔, 概念很模糊,这个空的vue实例应该放在哪里呢,光放文档并没 ...

  7. 《C++ Primer Plus》第4章 学习笔记

    数组.结构和指针是C++的3中符合类型.数组可以在一个数据对象中存储多个同种类型的值.通过使用索引或下标,可以访问数组中各个元素.结构可以将多个不同类型的值存储在同一个数据对象中,可以使用成员关系运算 ...

  8. poj_2823 单调队列

    题目大意 给定一行数,共N个.有一个长度为K的窗口从左向右滑动,窗口中始终有K个数字,窗口每次滑动一个数字.求各个时刻窗口中的最大值和最小值. 题目分析 直接搜索,复杂度为O(n^2).考虑使用单调队 ...

  9. Hibernate更新数据报错:a different object with the same identifier value was already associated with the session: [com.elec.domain.ElecCommonMsg#297e35035c28c368015c28c3e6780001]

    使用hibernate更新数据时,报错 Struts has detected an unhandled exception: Messages: a different object with th ...

  10. Elasticsearch 监控插件安装(elasticsearch-head与Kibana)

    摘要 安装Elasticsearch插件Head与Kibana 版本 elasticsearch版本: elasticsearch-2.3.4 elasticsearch-head版本: 2.x(支持 ...