XDU 1032
#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的更多相关文章
- sqlservr (708) 打开日志文件 C:\Windows\system32\LogFiles\Sum\Api.log 时出现错误 -1032 (0xfffffbf8)
在windows server 2012 standard上新安装好的SQL Server 2014,查看错误日志,发现此报错 sqlservr (708) 打开日志文件 C:\Windows\sys ...
- Light OJ 1032 - Fast Bit Calculations(数学)
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1032 题目大意:一个十进制数变化为二进制,那么对于这个数,如果连着两个二进制位 ...
- 1032: [JSOI2007]祖码Zuma
链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1032 Description 这是一个流行在Jsoi的游戏,名称为祖玛.精致细腻的背景,外加神 ...
- loj 1032 数位dp
题目链接:http://lightoj.com/volume_showproblem.php?problem=1032 思路:数位dp, 采用记忆化搜索, dp[pos][pre][have] 表示 ...
- 【转】[退役]纪念我的ACM——headacher@XDU
转自:http://hi.baidu.com/headacher/item/5a2ce1d50609091b20e25022 退役了,是时候总结一下我ACM的生涯了.虽然很舍不得,但这段回忆很值得纪念 ...
- PAT乙级 1032. 挖掘机技术哪家强(20)
1032. 挖掘机技术哪家强(20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 为了用事实说明挖掘机技术到底 ...
- [MySQL] SQL_ERROR 1032解决办法
一.缘由: 在主主同步的测试环境,由于业务侧没有遵循同一时间只写一个点的原则,造成A库上删除了一条数据,B库上在同时更新这条数据. 由于异步和网络延时,B的更新event先到达A端执行,造成A端找不到 ...
- 1032 - A-B 组合数学
http://www.ifrog.cc/acm/problem/1032 1032 - A-B Time Limit:1s Memory Limit:128MByte Submissions:680S ...
- hihocode ---1032
#include<iostream> #include<cstring> #include<cstdio> using namespace std; + ; ]; ...
随机推荐
- openstacksdk resource2 打印__dict__
在一个继承resource2的实体里,打印self.__dict__结果是: {'_body': <openstack.resource2._ComponentManager object at ...
- MFC获取系统当前时间
1.使用CTime类 CString str; //获取系统时间 CTime tm; tm=CTime::GetCurrentTime(); str=tm.Format("现在时间是%Y年% ...
- 关于CentOS系统中,文件权限第11位上是一个点的解读
http://blog.csdn.net/dashuai03091199/article/details/38920833 http://blog.csdn.net/xinlongabc/articl ...
- 上传Docker镜像到阿里云
1.配置阿里云的镜像加速器:https://cr.console.aliyun.com/#/accelerator 2.命令行登录到阿里云的doker仓库,--username为阿里云的用户名 d ...
- 【IIS】IIS 7.0/7.5 无法启动 w3svc 服务
一般情况下,window IIS安装完毕后,会启动C:\inetpub\ 产生 类似C:\inetpub\temp\apppools的文件夹,如果IIS被改动过,此文件夹不会自动生成.需要手动添加. ...
- ios 如何改变UISegmentedControl文本的字体大小?
UIFont *Boldfont = [UIFont boldSystemFontOfSize:16.0f]; NSDictionary *attributes = [NSDictionary dic ...
- java的list集合如何根据对象中的某个字段排序?
转自:http://blog.csdn.net/wangjuan_01/article/details/51351633 List集合按某个字段排序 package wjtest_01; import ...
- js apply()、call() 使用参考
引入,求一个数组的最大值,有这么一种快捷方法:Math.max.apply(null,arr); 但是最初看 JavaScript高级程序设计 的时候,没看懂,原文(斜体表示)如下: 每个函数都包含两 ...
- rabbitmq 用户管理
rabbitmqctl add_user root cor2016 rabbitmqctl set_user_tags root administrator http://host:15672/#/u ...
- How to Design a Good API and Why it Matters
前谷歌首席 Java 架构师谈如何设优秀的 API – 码农网 http://www.codeceo.com/article/google-java-good-api.html 2015-11-24 ...