自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

老铁,干了这碗algorithms的博客

每天都被自己菜到

  • 博客(11)
  • 收藏
  • 关注

原创 约瑟夫环问题 51nod

51nod 1073 使用数学知识,F(n,m)=(F(n-1,m)+m)%n; #include<iostream> #include<cstdio> using namespace std; int main() { int n,k; while(scanf("%d%d",&n,&k)==2) { int p...

2018-10-29 19:32:44 138

原创 poj 1091 容斥定理

题目传送门 //容斥定理 #include<iostream> #include<cstdio> #include<cstring> using namespace std; typedef long long LL; const int maxn=100+5; int fac[maxn],cnt; LL n,m,k,temp; LL pow(LL a,LL...

2018-10-23 22:52:23 157

原创 poj 2142 解线性同余方程 扩展gcd变形

题目传送门 1.先贴一个比较暴力的    547ms #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; typedef long long LL; const LL INF=0x3f3f3f3f; void e...

2018-10-22 23:06:42 193

原创 poj 3358 乘二取整法+欧拉定理+快速幂(注意溢出)

题目传送门 //把一个小于1的小数转化为二进制形式,找到最小循环部分的起始位置以及最小循环长度 //欧拉定理 十进制小数转化为二进制:乘二取整法 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; typedef long long LL; LL gcd(...

2018-10-22 21:37:20 434

原创 poj 3696 欧拉函数+快速幂+思维

题目传送门 //欧拉定理 #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; typedef long long LL; LL gcd(LL a,LL b) { return b==0?a:gcd(b,a%...

2018-10-20 19:56:01 219

原创 poj 2480 积性函数+欧拉函数

题目传送门 1. 欧拉函数 204ms //积性函数 #include<iostream> #include<cmath> #include<cstdio> using namespace std; typedef long long LL; LL euler(LL n) { LL res=n; for(int i=2;(LL)i*i&lt...

2018-10-20 15:49:30 223

原创 51nod 1120 卡特兰数+卢卡斯定理+乘法逆元

题目传送门 //卢卡斯+乘法逆元 #include<bits/stdc++.h> using namespace std; typedef long long LL; const LL MD=10007; LL mulit(LL a,LL b,LL m) { LL ans=0; while(b) { if(b&1) ans=(ans+...

2018-10-17 17:12:46 190

原创 hdu 1695 欧拉筛+容斥原理

题目传送门 //欧拉筛+容斥原理 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long LL; const int maxn=100000+5; int phi[maxn],t...

2018-10-11 22:37:23 175

原创 hdu 4704 费马小定理降幂+快速幂运算+组合数公式

题目传送门 //费马小定理降幂+快速幂 #include<iostream> #include<cstdio> #include<cstring> using namespace std; typedef long long LL; const int maxn=1e5+5; const int MD=1e9+6; char s[maxn]; int len...

2018-10-11 21:02:19 201

原创 hdu 3978 Evil teacher's Final Problem + hdu 4291 A Short problem

斐波那契数模p的循环节+矩阵快速幂 hdu 3978 #include <iostream> #include <string.h> #include <algorithm> #include <stdio.h> #include <math.h> using namespace std; typedef long long LL...

2018-10-10 22:46:12 169

原创 hdu 1005 矩阵快速幂

题目传送门 构造转移矩阵,进行矩阵快速幂即可,注意特判n<3时的情况 #include<iostream> #include<cstdio> using namespace std; typedef long long LL; int mod=7,a,b; struct matrix{ int m[2][2]; }; matrix mul(matrix A,ma...

2018-10-09 23:54:43 259

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除