SCOI 2010 生成字符串 组合数+逆元
计算组合数有许多方法,我先是分解质因数,但是这样效率非常低,1700ms。
然后求逆元,求解,时间复杂度为o(N).这个模数是质数,不用考虑逆元无解情况。#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;
LL K=20100403;
LL x,y;
void exgcd(LL a,LL b)
原创
2016-11-16 20:15:18 ·
442 阅读 ·
0 评论