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 ...
随机推荐
- nodejs 格式化 Date() 为yyyy-MM-dd HH:mm:ss 格式
===============2019-11-25更新======== 推荐:更实用完美解决时间格式化的 组件 monent 官网地址:http://momentjs.cn/ ============ ...
- c# 动态加载tlb为程序集
private enum RegKind { RegKind_Default = , RegKind_Register = , RegKind_None = } [DllImport("ol ...
- linux安装 redis(redis-3.0.2.tar.gz) 和 mongodb(mongodb-linux-x86_64-rhel62-4.0.0)
1:首先 要下载 这两个 压缩包 注意:liunx是否已经安装过 gcc没安装的话 先安装:yum install gcc-c++ 2:安装 redis:redis-3.0.2.tar.gz (1): ...
- 获取文件夹中前N个文件
@echo off set input="list.txt" set srcDir="%1" set /a fileCount=10 set /a curInd ...
- [Web 前端] 013 css 内外边距
1. css 内间距 也称:"内补白"或"内补丁" 参数 释义 padding 检索或设置对象四边的内部边距,如 padding:10px; padding:5 ...
- [Python3] 018 if:我终于从分支中走出来了
目录 0. 谁是主角 1. 从三大结构说起 (1) 顺序 (2) 分支 1) 分支的基本语法 2) 双向分支 3) 多路分支 (3) 循环 0. 谁是主角 分支是主角 我前面几篇随笔提到 if 不下2 ...
- MySQL的练习
mysql登录:方法1:使用Command Line Client登录,缺点:不显示报错信息 方法2:使用cmd登录(cmd的常用:查看ip地址:ipcongfi-----定时关机:shutdown ...
- JAVA总结--集合
1.集合树状图 Collection:最基本的集合接口 ----List:有序集合,集合中的元素可以重复,访问集合中的元素可以根据元素的索引来访问 ----ArrayList:异步 ----Linke ...
- hive DML操作
1.数据导入 1)向表中装载数据(load) 语法 hive> load data [local] inpath '/opt/module/datas/student.txt' [overwri ...
- Balanced Lineup poj3264 线段树
Balanced Lineup poj3264 线段树 题意 一串数,求出某个区间的最大值和最小值之间的差 解题思路 使用线段树,来维护最大值和最小值,使用两个查询函数,一个查区间最大值,一个查区间最 ...