
逆元
UCAS王小二
不念过去,不畏未来...
展开
-
hdu2669 逆元裸题
Problem DescriptionThe Sky is Sprite.The Birds is Fly in the Sky.The Wind is Wonderful.Blew Throw the TreesTrees are Shaking, Leaves are Falling.Lovers Walk passing, and so are You. ....原创 2017-04-06 22:32:13 · 413 阅读 · 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 评论 -
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 评论 -
Wannafly挑战赛11 A B D【规律+逆元+字符串hash】
链接:https://www.nowcoder.com/acm/contest/73/A 来源:牛客网 题目描述 白兔学会了分身术。 一开始有一只白兔,接下来会进行k轮操作,每一轮中每一只白兔都会变成p只白兔。 要求k轮后白兔的总数恰好为n。 要求找到两个正整数p,k,最大化p+k 输入描述: 输入一个正整数n(2<=n<=101...原创 2018-03-12 17:37:42 · 1481 阅读 · 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 评论 -
51nod 1119 机器人走方格 V2【组合数学+逆元】
思路: 写个dp式算出较小方格的,打个表。在纸上模拟画方格,在方格里面填数,根据方格里的数写出排列组合,推出组合公式:C(n - 1 + m - 1, n - 1),再用逆元处理下。#include<cstdio>#include<cstring>#include <algorithm>using namespace std;typedef long long LL;const LL m原创 2017-09-07 21:46:33 · 351 阅读 · 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 评论 -
zoj Modular Inverse
The modular modular multiplicative inverse of an integer a modulo m is an integer x such that a-1≡x (mod m). This is equivalent to ax≡1 (mod m).InputThere are multiple test cases. The first line原创 2017-03-22 15:46:09 · 303 阅读 · 0 评论 -
poj 1061青蛙的约会
青蛙的约会Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 112699 Accepted: 22909Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直原创 2017-03-22 22:05:19 · 331 阅读 · 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 评论 -
HDU 6333 Problem B. Harvest of Apples【莫队+组合数】
Problem Description There are n apples on a tree, numbered from 1 to n. Count the number of ways to pick at most m apples. Input The first line of the input contains an integer T (1≤T≤1e5) denotin...原创 2018-08-01 21:37:05 · 181 阅读 · 0 评论