自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

zxy160的博客

感觉有意思就好

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

原创 板子

大数java大数a+b:http://blog.csdn.net/zxy160/article/details/79583252 java大数a-b:http://blog.csdn.net/zxy160/article/details/79584460 java大数a*b:http://blog.csdn.net/zxy160/article/details/79584050 java...

2018-01-24 15:46:15 585

原创 二分

map::lower_bound(key):返回map中第一个大于或等于key的迭代器指针 map::upper_bound(key):返回map中第一个大于key的迭代器指针 一直搞不清判断和返回值怎么弄,比较迷。 lower_bound,二分查找求下界,就是当ans存在是返回它第一个出现的位置。int lower_bound(int k,int L,int R){ in...

2018-01-30 16:42:57 236

原创 hdu4135(容斥原理

题目hdu4135题解容斥原理简单解释: 解释完毕。 那么我们如何求这道题呢? 求[1,m]内与n互质的数的个数=m-[1,m]内与n不互质的个数(听起来就像废话,我一开始也是这么认为的,但是容斥原理就是求[1,m]内与n不互质的个数的)。 那么怎么求?首先举个例子 n除以奇数个数相乘的时候是加,n除以偶数个数相乘的时候是减。 就是这样,最后不懂就看代码吧!

2018-01-30 14:50:15 343

原创 poj2356(抽屉原理

题目poj2356思路抽屉原理 现在我们想办法把n变成n个物品,n-1变成n-1个抽屉。 sum[i]表示(a[1]+…+a[i])%n取模,那么sum[i]中表示的数只能是0到n-1,如果是0就满足题意,如果不是0,那么根据抽屉原理sum[i]为n个数,1~n-1中必定存在两个数是相等的。代码#include#include#include#include

2018-01-30 08:58:10 274

原创 poj2407(欧拉函数)hdu1695(线性求欧拉函数+容斥原理

题目(欧拉函数poj2407 欧拉函数是小于n的正整数中与n互质的数的数目 直接套欧拉函数公式,即将n素分解后有n=p1^k1*p2^k2*…pm^km,则euler(n)=n(1-1/p1)(1-1/p2)…*(1-1/pm) #include#include#define LL long longLL n;LL solve(LL n){ LL ans=n;

2018-01-29 17:58:40 259

原创 KMP,找出s字符串在T字符中的位置,或有几个

优质博客推荐 hdu1711#include#include#define mem(a,b) memset(a,b,sizeof(a))int a[1000005];int b[10005];int nex[10005];int n,m;void KMP(){ mem(nex,0); nex[0]=-1; int i=0,k=-1; whi

2018-01-25 16:13:36 712

原创 逆序数《求所有子序列的逆序对个数的和

题目玲珑杯1180题解一对逆序对对答案的贡献是2^(n-2) 故统计出逆序对个数后乘上即可 注意序列长1的情况什么什么的 O( nlogn )代码#include#include#include#includeusing namespace std;#define LL long long int#define mod 1000000007LL

2018-01-24 15:33:34 892

原创 RMQ板子(ST算法)(求某个范围内距离的最大最小值)

优质博客推荐 RMQ板子题:poj3264#include#include#include#include#includeusing namespace std;#define mem(a,b) memset(a,b,sizeof(a))const int maxn=50005;int n,m;int a[maxn];int fm[maxn][35];int fmi

2018-01-24 11:21:15 326

原创 LCA,有向图求两点间距离,无向图求两点间距离,倍增

LCA就是求公共祖先。优质博客推荐 但是不推荐它的伪代码,感觉思路没错,但是有点问题。 我随手写了一个,有错欢迎之处int get(int u){ if(f[u]==u) return u; else f[u]=get(f[u]);}void dfs(int u,int pre){ //vis[u]=1;//位置1 for(int i=first...

2018-01-20 19:54:36 913

原创 连通图板子

一.tarjan算法求一个图有几个连通图。#include#include#include#include#include#define mem(a,b) memset(a,b,sizeof(a))#define LL long longusing namespace std;const int maxn=1e5;int n,m;struct node{ in

2018-01-17 20:51:04 223

原创 Codeforces Round #415 (Div. 2)

A. Straight «A» time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Noora is a student of one famous high school. It’s her final year in schoo

2018-01-16 21:14:58 271

原创 Codeforces Round #416 (Div. 2) A

A. Vladik and Courtesy time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output At regular competition Vladik and Valera won a and b candies respe

2018-01-16 21:12:45 170

原创 Codeforces Round #417 (Div. 2) A

A. Sagheer and Crossroads time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Sagheer is walking in the street when he comes to an intersectio

2018-01-16 21:11:12 190

原创 Codeforces Round #419 (Div. 2) A

A. Karen and Morning time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Karen is getting ready for a new school day!It is currently hh:mm,

2018-01-16 21:09:51 169

原创 Codeforces Round #420 (Div. 2) A

A. Okabe and Future Gadget Laboratory time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Okabe needs to renovate the Future Gadget Laborator

2018-01-16 21:08:29 163

原创 Codeforces Round #421 (Div. 2) A

A. Mister B and Book Reading time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mister B once received a gift: it was a book about aliens, w

2018-01-16 21:06:58 153

原创 Educational Codeforces Round 21 A

A. Lucky Year time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Apart from having lots of holidays throughout the year, residents of Berland

2018-01-15 21:24:52 183

原创 Codeforces Round #413, rated, Div. 1 + Div. 2 A

A. Carrot Cakes time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output In some game by Playrix it takes t minutes for an oven to bake k carrot ca

2018-01-15 20:30:23 166

原创 网络流算法板子

最大流:EK,FF,Dinic,ISAP。因为实现方法几乎差不多,记住最优的即可。 Dinic#include#include#include#include#include#includeusing namespace std;const int maxn=1000;const int inf=0x3f3f3f3f;#define LL long longstru

2018-01-13 19:26:13 439

原创 Codeforces Round #455 (Div. 2)

A. Generate Login time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The preferred way to generate user login in Polygon is to concatenate a

2018-01-11 21:19:38 210

原创 Educational Codeforces Round 35 (Rated for Div. 2) A

A. Nearest Minimums time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given an array of n integer numbers a0, a1, …, an - 1. Find t

2018-01-11 21:13:28 377

原创 Hello 2018 B

题目:http://codeforces.com/contest/913/problem/B 一开始读错题了,以为必需是==3,其实是>=3。 然后发现忘了标记根节点。 然后发现a数组标记取消是清零,而不是–。 然后换了一种写法,最终还是WA。其实前三种标记就错了,不应该排序。 第四种数组跑出界了,竟然不判RE,气死啦!#include#include#include#in

2018-01-09 10:58:13 214

原创 Hello 2018 A

A. Modular Exponentiation time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The following problem is well-known: given integers n and m, cal

2018-01-09 10:48:18 314

原创 Codeforces Round #456 (Div. 2)

B. New Year’s Eve time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Since Grisha behaved well last year, at New Year’s Eve he was visited by

2018-01-07 21:11:11 258

原创 Codeforces Round #456 (Div. 2)

A. Tricky Alchemy time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output During the winter holidays, the demand for Christmas balls is exceptiona

2018-01-07 20:37:52 259

空空如也

空空如也

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

TA关注的人

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