- 博客(10)
- 收藏
- 关注
原创 简单数据结构模板
1,树状数组int C[maxn<<4] , a[maxn] , n;int lowbit(int x){ return x&(-x);}int Sum(int pos){ int ans = 0; while(pos>0) ans += C[pos] , pos -= lowbit(pos); return ans ;}...
2018-08-01 16:08:51 468
原创 Palindrome subsequence HDU - 4632
HDU - 4632 In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the se...
2018-08-31 17:19:28 180
原创 Halloween Costumes LightOJ - 1422 (区间dp)
LightOJ - 1422Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all cost...
2018-08-31 17:10:04 387
原创 洛谷P2181 对角线
题目描述对于一个N个定点的凸多边形,他的任何三条对角线都不会交于一点。请求楚图形中对角线交点的个数。例如,6边形:输入输出格式输入格式: 第一行一个n,代表边数。 输出格式: 第一行输出交点数量 输入输出样例输入样例#1: 复制3输出样例#1: 复制0输入样例#2: 复制6输出样例#2: 复制15说明...
2018-08-27 16:13:28 843
原创 大数素数判断(Miller_Rabin)及素因子分解(Pollard_rho)(模板)
#define LL long long#define ULL unsigned long long const int S=20;//int judge[12] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37};/*** 判断素数 ***/LL mult_mod(ULL a, ULL b, LL mod) //防止 a*b ...
2018-08-22 01:17:50 606
原创 find the longest of the shortest(最短路并记录路径)
hdu1595Marica is very angry with Mirko because he found a new girlfriend and she seeks revenge.Since she doesn't live in the same city, she started preparing for the long journey.We know for every r...
2018-08-07 17:20:12 275
原创 Nastya Studies Informatics(gcd)
Codeforces Round #489 (Div. 2)/Boutputstandard outputToday on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she solved all the tasks moment...
2018-08-07 11:06:23 271
原创 数列(前缀和,离散化)
P1667 数列题目描述给定一个长度是n的数列A,我们称一个数列是完美的,当且仅当对于其任意连续子序列的和都是正的。现在你有一个操作可以改变数列,选择一个区间[X,Y]满足Ax +Ax+1 +…+ AY<0,1<X<=Y<n,令S=Ax +Ax+1 +…+ AY,对于Ax-1和AY+1分别加上S,Ax和AY分别减去S(如果X=Y就减两次)。问最少几次这样的操作使得...
2018-08-05 20:10:33 946
原创 Crossing 树状数组
poj 3416CrossingTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 1883 Accepted: 858 DescriptionWintokk has collected a huge amount of coins at THU. One day he had a...
2018-08-05 11:10:55 297
原创 HDU 1429 胜利大逃亡(续) (状压bfs)
胜利大逃亡(续) HDU - 1429 Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)…… 这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx,sy)的位置,离开地牢的门在(ex,ey)的位置。Ignatius每分钟只能从一个坐标走到相邻四个坐标中的其中一个。魔...
2018-08-04 20:23:24 138
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人