
费马小定理
UCAS王小二
不念过去,不畏未来...
展开
-
hdu4704 费马小定理+快速幂
Problem Description Sample Input2 Sample Output2Hint1. For N = 2, S(1) = S(2) = 1.2. The input file consists of multiple test cases. 思路:写下规律,就是求2^(n-1)%mod,但是n比较原创 2017-04-10 21:34:55 · 385 阅读 · 0 评论 -
HDU4869 组合数学+费马小定理求逆元+快速幂
Problem DescriptionDuring summer vacation,Alice stay at home for a long time, with nothing to do. She went out and bought m pokers, tending to play poker. But she hated the traditional gameplay. S转载 2017-04-11 14:56:48 · 439 阅读 · 0 评论 -
zzuli 2180 GJJ的日常之沉迷数学【矩阵快速幂 || 逆元】
DescriptionGJJ每天都要膜拜一发数学大佬,因为GJJ的数学太差了。这不,GJJ又遇到难题了,他想求助WJJ,但是WJJ这几天忙于追妹子,哪有时间给他讲题, 于是GJJ求助于热爱ACM的你,Acmer们能帮帮他吗?问题是求: k^0 + k^1 +…+ k^(n) mod p (0 < k < 100, 0 <= n <= 10^9, p = 1000000007) 例如:6^0 + 6原创 2017-08-18 20:40:31 · 542 阅读 · 0 评论 -
数论总结
前言:走进区域赛,切实的发现数论和思维的重要性,于是弱鸡努力总结一波!一:约数个数定理定义g(x),为x的约数个数,对于一个数i,可分解成若干质数幂次的乘积,即: i=prime[1]a∗prime[2]b∗….. g(i)=(a+1)∗(b+1)∗……二:整除的基本性质a|b b|c => a|c a|b a|c => a|bc a|b a|c => a|ib±jc原创 2017-11-06 22:27:54 · 761 阅读 · 0 评论 -
Wannafly挑战赛13【A B C D】【逆元+数学+优先队列】
A zzy的小号 链接:https://www.nowcoder.com/acm/contest/80/A 来源:牛客网 题目描述 学家zzy根据字体的特点,创建了一系列小号… I_Love_Chtholly! 又到了打wannafly的时候,许许多多的大佬准备注册小号开始虐场,zzy也不例外,他发现他的电脑的字体有一个特点!某些不同的字符所显示的是一样的! ...原创 2018-04-08 14:17:46 · 387 阅读 · 0 评论 -
牛客小白月赛1
A 简单题 分析:没什么好说的,枚举精度就可以。。。#include <bits/stdc++.h>#define pi exp(1.0)using namespace std;typedef long long LL;const int MAXN = 1e3 + 10;int main() { int n, a, c; scanf("%d", &a...原创 2018-04-07 09:36:48 · 385 阅读 · 0 评论