http://codeforces.com/gym/100633/problem/J Lucas定理P不是质数裸题 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typedef long long ll; inline ll read(){ ,f=; ;c=get…
传送门 [题意]: 求C(n,k)%m,n<=108,k<=n,m<=106 [思路]: 扩展lucas定理+中国剩余定理    #include<cstdio> using namespace std; typedef long long ll; ll n,m,MOD,ans; ll fpow(ll a,ll p,ll mod){ ll res=; ,a=a*a%mod) ) res=res*a%mod; return res; } void exgcd(ll a,ll b…
默默敲了一个下午,终于过了, 题目传送门 扩展Lucas是什么,就是对于模数p,p不是质数,但是不大,如果是1e9这种大数,可能没办法, 对于1000000之内的数是可以轻松解决的. 题解传送门 代码完全手写,直接写了扩展的中国剩余定理(普通的不会写) 题意:给你n,m,p 求C(n,m)%p #include<cstring> #include<cmath> #include<cstdio> #include<iostream> #include<a…
J. Ceizenpok’s formula time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dr. Ceizenp'ok from planet i1c5l became famous across the whole Universe thanks to his recent discovery — the Ceizenp…
[题外话:我......不补了......] 2015 ICL, Finals, Div. 2:http://codeforces.com/gym/100637 G. #TheDress[水] (strstr函数真好用......) 代码: #include<bits/stdc++.h> using namespace std; ]; int main() { int n, i; scanf("%d ", &n); , y = , z = ;//地球人,外星人,其他…
J. Ceizenpok’s formula time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output Dr. Ceizenp'ok from planet i1c5l became famous across the whole Universe thanks to his recent discovery — the Ceizenpok’s formul…
http://codeforces.com/gym/100633/problem/J 其实这个解法不难学的,不需要太多的数学.但是证明的话,我可能给不了严格的证明.可以看看这篇文章 http://www.cnblogs.com/jianglangcaijin/p/3446839.html   膜拜 #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include…
http://codeforces.com/contest/394 话说这次CF做的超级不爽,A题一开始交过了,我就没再管,B题还没看完呢,就死困死困的,后来觉得B题枚举一下估计能行,当时是觉得可以从后往前乘,但是细节什么的都没想好,所以干在纸上画也没写出什么来.没想到我A题竟然忘了一种情况,就是+前就一根的时候,郁闷死我了. A  Counting Sticks #include <stdio.h> #include <string.h> #include <iostrea…
由于一次比赛被虐得太惨,,生发开始写blog的想法,于是便有了这篇随笔(找了个近期的cf比赛练练手(bushi))第一次写blog,多多包涵. 第二场cf比赛,第一场打的Div2,被虐太惨,所以第二场挑了个Div4... 比赛链接: https://codeforces.com/contest/1669 A. Division 翻译(参考): t组样例,每组样例给出一个正整数,判断该整数所在的范围 题解: 签到题,分类讨论下即可 B.Trip 翻译(参考): t组样例,每组给出一个长度为n的数组…
J. Usoperanto Time Limit: 8000ms Memory Limit: 256000KB Usoperanto is an artificial spoken language designed and regulated by Usoperanto Academy. The academy is now in study to establish Strict Usoperanto, a variation of the language intended for for…