数学
reedthink
学习不是百米赛跑,是马拉松。要长久的保持热情。
。。。。。。。。。。。。。。。。。。。。要少水群
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
数学定理
1.齐肯多夫定理表示任何正整数都可以表示成若干个不连续的斐波那契数(不包括第一个斐波那契数)之和。这种和式称为齐肯多夫表述法。 2.韦达定理:3....原创 2018-10-03 15:42:46 · 701 阅读 · 0 评论 -
Miller_Rabin 算法 快速判断大质数(存在误差,非确定算法)
#include <bits/stdc++.h>using namespace std;typedef long long ll;ll mod;ll mul(ll a,ll b) //高精度{ a%=mod; b%=mod; ll c=(long double)a*b/mod; ll ans=a*b-c*mod; return (ans...转载 2019-07-30 11:57:33 · 220 阅读 · 0 评论 -
2019 杭电 多校第3场 1006 Fansblog (HDU 6608)
题目链接题解:威尔逊定理转换后,就是求逆元。代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;ll exgcd(ll a,ll b,ll &x,ll &y){ if(a==0&&b==0) return -1; if(b==0) {x=1...原创 2019-07-30 08:33:06 · 191 阅读 · 0 评论 -
两球的体积并
#include<cstdio>#include<algorithm>#include<cstring>#include<iostream>#include<math.h>#define CLR(a,b) memset(a,b,sizeof(a));const int inf=0x3f3f3f3f;using namesp...转载 2019-03-01 20:15:25 · 252 阅读 · 0 评论 -
codeforces-1084C The Fair Nut and String(数学题)
已迁移New blog原创 2019-01-22 20:10:30 · 275 阅读 · 0 评论 -
codeforce1105C(数学+DP)
题目点这里原创 2019-01-21 18:01:16 · 363 阅读 · 0 评论 -
zzuli 1605 数字序列 (矩阵快速幂取模)
题目描述一个数列的定义如下:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.给出A和B,你要求出f(n).输入输入包含多个测试案例。每个测试用例包含3个整数A,B和n在一行(1<=A,B≤1000,1≤n≤100000000)。当输入三个0表示结束输出对于每个测试案例,输出f(n),单独占...原创 2018-12-27 18:00:28 · 392 阅读 · 0 评论 -
51nod 1003 阶乘后面0的数量
题目就是题意分析:一个数 n 的阶乘末尾有多少个 0 取决于从 1 到 n 的各个数的因子中 2 和 5 的个数, 而 2 的个数是远远多余 5 的个数的, 因此求出 5 的个数即可.题解中给出的求解因子 5 的个数的方法是用 n 不断除以 5, 直到结果为 0, 然后把中间得到的结果累加. 例如, 100/5 = 20, 20/5 = 4, 4/5 = 0, 则 1 到 100 中因子 ...转载 2018-12-19 21:12:22 · 204 阅读 · 0 评论 -
Codeforce 1076B Divisor Subtraction 2/5
题目链接:http://codeforces.com/contest/1076/problem/BB. Divisor Subtractiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are...原创 2018-11-13 18:59:32 · 500 阅读 · 0 评论 -
HDU 6322 Euler Function (欧拉函数的求法) 1/5
题目链接:https://vjudge.net/problem/HDU-6322题意:给一个数k,求第k小的n值,n满足φ(n)是合数。欧拉函数定义:小于n的正整数中与n互质的数的数目就是φ(n)的值,n为正整数。对欧拉函数打表发现,只有1 2 3 4 6 的欧拉函数值不是合数,则满足要求的第1小对应的n值为5,其余则为k+5;代码:#include<stdio.h&g...原创 2018-11-06 17:00:16 · 196 阅读 · 0 评论 -
HDU 5950 Recursive sequence (矩阵快速幂)1/5
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=59502018 年10 月30日 本周第一篇解题报告 (解题报告计划,第二周)Problem DescriptionFarmer John likes to play mathematics games with his N cows. Recently, they are at...原创 2018-10-30 22:23:52 · 233 阅读 · 0 评论 -
n的阶乘位数(斯特林公式)
求n的阶乘位数,套用斯特林公式直接上代码。因为对精确度要求更高,自然对数的底数e要精确到小数点后12位,圆周率精确到小数点后13位#include <stdio.h>#include<math.h>#define e 2.718281828459#define PI 3.1415926535898int main(){ int t; ...原创 2018-10-10 15:08:23 · 6041 阅读 · 4 评论 -
HDU 1061 Rightmost Digit(n的n次方的个位数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1061题意很简单,,就是求n的n次方的末位数字,常见做法有两种:1.快速幂取模2.打表找规律我采用第一种做法。不过我直接套了个整数超大次幂取模的模板,用了欧拉降幂处理指数(这一题数据偏弱,没有卡欧拉降幂,前几天做杭电多校遇到一道题,但是欧拉降幂无法做) 。当然对于这道题主要运用了快速幂取...原创 2018-10-07 16:18:04 · 391 阅读 · 0 评论 -
HDU 5974 A Simple Math Problem
题目链接:https://vjudge.net/problem/HDU-5974题意:已知两个正整数x,y的和为a,以及x,y的最小公倍数为b,求x,y自己并没有推出来数学规律,百度到规律为 : gcd(a,b)与gcd(x,y)相等 那么容易得到:x*y等于b*gcd(a,b)此时,x,y的和与积已知,联立求解,最后判断是否可以得到整数解ps: 一条性质:如果x与y互质,...原创 2018-10-12 17:10:46 · 216 阅读 · 0 评论 -
HDU 6441 Find Integer(费马大定理,勾股数的推导)
题目链接分析:费马大定理:仅仅在n为1或 2时题目中公式才成立,n为1时,随便整一组b和c即可。勾股数推导见代码里的注释代码#include <stdio.h>#include <math.h>using namespace std;typedef long long ll;// 当a为大于1的奇数2n+1时,b=2n^2+2n, c=2n^2+2n+1...原创 2019-08-20 20:47:40 · 170 阅读 · 0 评论
分享