Quick Notes
激励
每当在书中读及那些卑微的努力,都觉得感动且受震撼。也许每个人在发出属于自己的光芒之前,都经历了无数的煎熬,漫长的黑夜,无尽的孤独,甚至不断的嘲讽和否定,但好在那些踮脚的少年,最后都得到了自己想要的一切。
link
https://me.csdn.net/sz_165394732
https://www.luogu.org/discuss/show/82076
compare
int jc[mod], ijc[mod];
inline int qpow(int x, int y) {
int r=1;
for (; y; y>>=1, x=x*x%mod) if (y&1) r=r*x%mod;
return r;
}
inline void init() {
jc[0]=1; for (int i=1; i<mod; ++i) jc[i]=jc[i-1]*i%mod;
ijc[mod-1]=qpow(jc[mod-1], mod-2);
for (int i=mod-2; i>=0; --i) ijc[i]=ijc[i+1]*(i+1)%mod;
}
inline int C(int x, int y) {return jc[x]*(ijc[x-y]*ijc[y]%mod)%mod; }
inline int lucas(int x, int y) {
if (y>x) return 0;
int r=1;
for (; y; x/=mod, y/=mod) r=r*C(x%mod, y%mod);
return r;
}
int T, n, m;
int main() {
init();
scanf("%d", &T);
while (T--) {
scanf("%d%d", &n, &m);
printf("%d\n", lucas(n, m));
}
return 0;
}
int jc[mod], inv[mod], t, n, m;
inline int lucas(int a, int b) {
if (a > b) return 0;
if (b <= mod) return jc[b] * inv[a] % mod * inv[b - a] % mod;
return lucas(a / mod, b / mod) * lucas(a % mod, b % mod) % mod;
}
int main(void) {
jc[0] = jc[1] = inv[0] = inv[1] = 1;
for (int i = 2; i < mod; ++i) jc[i] = jc[i - 1] * i % mod, inv[i] = (mod - mod / i) * inv[mod % i] % mod;
for (int i = 2; i < mod; ++i) inv[i] = inv[i - 1] * inv[i] % mod;
for (scanf("%d", &t); t; --t) scanf("%d%d", &n, &m), printf("%d\n", lucas(m, n));
return 0;
}
ぼくのフレンド (Boku no Friend)
aienkien ichigoichie
sode suriau mo tashou no en
kono yo no kiseki gyutto tsumete
kimi to deaetanda
aoi haru itsuka maku o toji
sakura to tomo ni maichittemo
kanarazu bokura mata dokoka de
deai o hatasu darou
kakegae nai
boku to nita kimi e
hitori de koronde kizu darake ni natta toki wa
itsudemo dokomademo hashiru yo
tama ni wa kenka shite okorou
nakigao mitara nagusameyou
tobikiri no nagai o sekkyou wa mijikame ni shite
kirei na mono o sagashi ni yukou
oishii mono mo takusan tabeyou
tsumari wa korekara mo douka yoroshiku ne
toki ga tatsu no wa hayai mono de
wakare no kisetsu ga kao o dasu
tsumiagetekita mono ga yake ni
namida o sasounda
aoi haru ga ima maku o toji
sakura ga chiru oto wa shizuka de
setsunai omoi ga oshiyoseta
sayonara no yuuyake
kakegae nai
boku to nita kimi wa
hitori demo daijoubu dakara tada mae o mite
hirogaru michi o hashirunda
tama ni wa futari katariaou
iya na koto zenbu hakidasou
tobikiri no nagai adobaisu wa chanto kiitete
ureshii koto wa houkoku shiyou
atarashii deai daiji ni shiyou
tsumari wa itsudemo itsumademo?
aa bokura wa tatta ima
gooru wa betsubetsu sutaato rain
omoide shimaikonde
fumidashita saki wa mirai e
kakegae nai
boku to nita kimi wa
hitori demo daijoubu dakara tada mae o mite
hirogaru michi o hashirunda
tama ni wa hodohodo ni yasumou
yasumetara yururi to susumou
tobikiri nagai kinkyou houkoku omachi shitemasu
doredake teki o tsukurou tomo
boku ga kimi no mikata de iru kara
tsumari wa korekara mo douka yoroshiku ne
Quick Notes的更多相关文章
- Git Commands Quick Notes
Fetch This command is to make sure your local repository has the same knowledge of the remote-tracki ...
- 如何调试IIS错误信息
原文链接: http://blogs.msdn.com/b/tess/archive/2009/03/20/debugging-a-net-crash-with-rules-in-debug-diag ...
- the security of smart contract- 1
https://blog.zeppelin.solutions/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05 这个 ...
- MongoDB add sharding -- Just a note
1. Configure Configuration Server. 1.1. Create a directory: e.g. C:\data\dbs\config 1.2. Start confi ...
- 如何利用Emacs进行个人时间管理(GTD)
1. 简介 1.1 什么是GTD Get Things Done(GTD),是一套时间管理方法,面对生活中如下情况: 有很多事情要做 每件事情有主次之分 个人精力有限 我们需要随时很方便的了解我们下一 ...
- MapServer教程3
Compiling on Unix Compiling on Win32 PHP MapScript Installation .NET MapScript Compilation IIS Setup ...
- Git for Windows v2.11.0 Release Notes
homepage faq contribute bugs questions Git for Windows v2.11.0 Release Notes Latest update: December ...
- Canu Quick Start(快速使用Canu)
Canu Quick Start Canu Quick Start PBcR (老版的canu) CA Canu specializes in(专门从事) assembling PacBio or O ...
- (转) Quick Guide to Build a Recommendation Engine in Python
本文转自:http://www.analyticsvidhya.com/blog/2016/06/quick-guide-build-recommendation-engine-python/ Int ...
随机推荐
- Vue组件父子间通信01
子组件传递数据 用户已经登录 父组件接收数据 并显示列表,未登录不显示列表 /* 有两个组件,分别是main-component,header-component.main-component是由he ...
- 如何实现动态水球图 --》 echars结合echarts-liquidfill实现
1)项目中作为项目依赖,安装到项目当中(注意必须要结合echars) npm install echarts vue-echarts --save npm install echarts-liquid ...
- java程序利用ansible修改redis服务参数
第一步,java调用shell paraname和paravalue是传给playbook的变量. try { String cmd5 = "sudo ansible-playbook /s ...
- Web高级 JavaScript中的数据结构
复杂度分析 大O复杂度表示法 常见的有O(1), O(n), O(logn), O(nlogn) 时间复杂度除了大O表示法外,还有以下情况 最好情况时间复杂度 最坏情况时间复杂度 平均情况时间复杂度 ...
- HackGame2 writeup
网址:http://hackgame.blackbap.org/ 第一关 突破客户端:无论输入什么密码都会提示"密码不能为空",使用浏览器检查网页元素会发现提交时会触发 javas ...
- Hibernate入门4
HIbernate的导航查询: 适用场景:当一张A表关联到另一张B表的多条记录,存在一对多的关系(或者多对多),那么查询A表的记录时,就可以将A表某条记录关联的B表的所有记录查询出来,这种方式,就叫做 ...
- javascript数组排序和prototype详解
原型的概念::原型对象里的所有属性和方法 被所有构造函数实例化出来的对象所共享,类似于java中的 static 正因为共享所以单一的操作 就会影响了全局,因此使用时需注意 基于prototype:为 ...
- [2019杭电多校第四场][hdu6621]K-th Closest Distance(主席树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6621 题意为求区间[l,r]内第k小|a[i]-p|的值. 可以二分答案,如果二分的值为x,则判断区间 ...
- Codeforces - 1198C - Matching vs Independent Set - 贪心
https://codeforces.com/contest/1198/problem/C 要选取一个大小大于等于n的匹配或者选取一个大小大于等于n的独立集. 考虑不断加入匹配集,最终加入了x条边. ...
- 51nod - 1586 - 约数和 - 打表 - 思维
https://www.51nod.com/Challenge/Problem.html#problemId=1586 一眼看过去居然一点思路都没有的,一言不合就打表,打贡献表. #include & ...