- 博客(30)
- 收藏
- 关注
原创 hdu 6006 Engineer Assignment(状压)
题目:here主要思路:离散化之后进行状压dp#include #include #include #include using namespace std;typedef long long ll;const int maxn=1e5+5;int engi[15][5];int pro[15][5];int dp[15][1200];int v
2017-04-22 22:11:07
895
1
原创 hihoCoder 1496 寻找最大值
描述给定N个数A1, A2, A3, ... AN,小Ho想从中找到两个数Ai和Aj(i ≠ j)使得乘积Ai × Aj × (Ai AND Aj)最大。其中AND是按位与操作。 小Ho当然知道怎么做。现在他想把这个问题交给你。输入第一行一个数T,表示数据组数。(1 对于每一组数据:第一行一个整数N(1第二行N个整数A1, A2, A3, ... AN(0 Ai
2017-04-04 16:39:13
639
原创 UVA 1378 A Funny Stone Game (经典博弈)
题目传送门代码不是关键,关键的是#include using namespace std;const int N=100005;int vis[80],sg[30],num[30];int init(){ sg[1]=0; for(int i=2;i<=23;i++) { memset(vis,0,sizeof(vis))
2017-03-03 19:44:38
490
原创 Codeforces Round #379 (Div. 2) E Anton and Tree
E. Anton and Treetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton is growing a tree in his garden. In case you
2016-11-17 20:53:06
398
原创 Codeforces Round #379 (Div. 2) Anton and Chess
D. Anton and Chesstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton likes to play chess. Also, he likes to do pr
2016-11-16 14:36:17
389
原创 Codeforces Round #379 (Div. 2) C. Anton and Making Potions
C. Anton and Making Potionstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton is playing a very interesting compu
2016-11-16 12:31:25
322
转载 HDU5950(矩阵快速幂)
转载:自己看方便题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5950题意:f(n) = f(n-1) + 2*f(n-2) + n^4,f(1) = a , f(2) = b,求f(n)思路:对矩阵快速幂的了解仅仅停留在fib上,重现赛自己随便乱推还一直算错,快两个小时才a还wa了好几次....主要就是构造矩阵:(n+1)^4
2016-11-01 19:10:58
360
原创 hdu 5934(强连通缩点)
BombTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 46 Accepted Submission(s): 22Problem DescriptionThere are N bombs needing e
2016-10-29 20:43:55
1017
原创 Codeforces Round #375 (Div. 2) D. Lakes in Berland
D. Lakes in Berlandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe map of Berland is a rectangle of the size n ×
2016-10-19 11:01:49
344
原创 Codeforces Round #375 (Div. 2) C Polycarp at the Radio
C. Polycarp at the Radiotime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is a music editor at the radio stat
2016-10-19 10:59:27
285
原创 Codeforces Round #372 Complete The Graph
题目链接:点击打开链接题意:B. Complete The Graphtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputZS the Coder has drawn
2016-10-05 22:35:18
328
原创 hdu 5900 QSC and Master 区间dp
Every school has some legends, Northeastern University is the same.Enter from the north gate of Northeastern University,You are facing the main building of Northeastern University.Ninety-nine perc
2016-09-18 18:10:51
301
原创 Codeforces Round #369 (Div. 2) C. Coloring Trees
ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park wheren trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers
2016-08-30 13:36:44
341
转载 FFT 入门
转载自:http://www.gatevin.moe/acm/fft%E7%AE%97%E6%B3%95%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/写在前面 关于学习FFT算法的资料个人最推荐的还是算法导论上的第30章(第三版), 多项式与快速傅里叶变换, 基础知识都讲得很全面 这篇文章即是博主在阅读FFT算法的相关学习资料之后的一些总结,
2016-08-12 15:07:29
1830
转载 全新的动态规划入门——从维度谈起
转载请注明出处:http://www.cnblogs.com/WABoss/p/DP.html 动态规划(Dynamic Programming, DP)是运筹学的一个分支,是求解决策过程(decision process)最优化的数学方法……(先忘了这个吧)允许我从另一个角度去理解并解释动态规划,那么开始吧。 一、维度首先说明维度(Dimension)这个
2016-08-10 09:29:07
1125
原创 hdu 5813 Elegant Construction (模式)
Elegant ConstructionTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 27 Accepted Submission(s): 14Special JudgeProblem Description
2016-08-09 18:13:03
235
原创 hdu 5800 计数dp
To My GirlfriendTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 929 Accepted Submission(s): 359Problem DescriptionDear GuoI n
2016-08-08 22:58:55
275
原创 Codeforces Round #366 (Div. 2) C. Thor
题目链接:点击打开链接C. Thortime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThor is getting used to the Earth. As a gift Lok
2016-08-08 12:21:26
488
原创 bestcoder #86 第三题 NanoApe Loves Sequence Ⅱ hdu 5806
NanoApe Loves Sequence ⅡAccepts: 374Submissions: 946Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 262144/131072 K (Java/Others)问题描述退役狗 NanoApe 滚回去学文化课啦!在数学课上,NanoApe 心痒痒又
2016-08-06 21:32:42
270
原创 hdu 5802 Windows 10
题目:Windows 10Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionLong long ago, the
2016-08-04 17:06:45
479
原创 Codeforces Round #364 F Break Up
题目链接:点击打开链接F. Break Uptime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAgain, there are hard times in Berland! Ma
2016-08-03 10:55:27
620
原创 hdu 5777 贪心
题目:小白在玩一个游戏。桌子上有n张多米诺骨牌排成一列。它有k次机会,每次可以选一个还没有倒的骨牌,向左或者向右推倒。每个骨牌倒下的时候,若碰到了未倒下的骨牌,可以把它推倒。小白现在可以随意设置骨牌的高度,但是骨牌高度为整数,且至少为1,并且小白希望在能够推倒所有骨牌的前提下,使所有骨牌高度的和最小。输入描述第一行输入一个整数T(1≤T≤101\leq T \leq 101≤T
2016-07-31 08:26:28
413
原创 lightoj 1045(数论)
题目链接:here身为数论弱弱,今天开始刷数论,今天就学了一招(取对数求位数)题意:n!的m进制一共多少位------------------------------------- 想到了怎么预处理,可惜没想到对数这个工具orz log(n!) = log(n)+log(n-1) + log(n-2) +...+log
2016-04-29 19:54:17
486
原创 lightoj 1007Mathematically Hard (欧拉函数水题)
题目链接:here如题:水题;但是好坑。。。。。。。注意:①筛法欧拉函数先除再乘,可使用int数组(这题开两个 unsigned long long 爆内存)或者sum数组和euler数组使用同一个数组 ②long long 居然不能过,long long居然不能过,long long不能过,所以要用unsiged long long
2016-04-28 15:37:19
336
原创 sdut 2605
题目链接:here思路:一开始看到n是1e5,于是就直接用快速幂了,然后就TLE了,手动 既然nlogn不行,那么只能o(n)了; =-= 然后就只能打表了; 由于m是1e9,所以数组空间存不下,只能改变进制了; 将其改为3300
2016-04-27 18:32:32
267
原创 zoj3946 Highway Project(单源最短路径)
题目传送门题意:一个帝国有 n 个城市,可以在城市两两之间建立 m 条高速公路,建立 x,y 之间的高速路需要时间 d(双向),花费为 c,最后建立完边后,使得首都 0 号城市到各个城市的总时间最少的前提下,选择总时间最少的。由于最后产生的图为一个树,因此对于每一个点,都可以假定出(面向起点的)有向边;#in
2016-04-26 11:58:50
413
原创 hdu 3635(并查集)
题目大意:初始时,有n个龙珠,编号从1到n,分别对应的放在编号从1到n的城市中。现在有2种操作:T A B,表示把A球所在城市全部的龙珠全部转移到B球所在城市。Q A,表示查询A。要求得到的信息分别是:X:A现在所在的城市,Y:A所在城市的龙珠数目,Z:A转移到该城市移动的次数如果并查集是一种模板,那么这道题一定是要对模板有一定理解才能做的。所要求的X:就是求集
2016-04-13 16:40:17
323
原创 hdu5653 Bomber Man wants to bomb an Array(dp)
给一个长度为 NNN 的一维格子和一些炸弹的位置,请你计算 “最大总破坏指数”。每个炸弹都有向左和向右的破坏力,如果一个炸弹向左和向右的破坏力分别为 LLL 和 RRR,那么该炸弹将炸毁 L+R+1L + R + 1L+R+1 个格子(左边LLL个,炸弹所在格子,右边RRR个)。破坏指数的计算方式为:所有炸弹炸毁的格子数的乘积。假设第 iii 个炸弹炸毁了 XiX_iXi个格子,那
2016-03-28 21:28:13
270
原创 hdu5652 India and China Origins bfs+二分
题目:很久以前,中国和印度之间并没有喜马拉雅山相隔,两国的文化交流很频繁。随着喜马拉雅山海拔逐渐增加,两个地区的交流也越来越少,最终没有了来往。假设当时的地形和我画的一样,蓝色部分代表海洋,而且当时人们还没有发明轮船。黄色部分代表沙漠,而且沙漠上经常有野鬼散步,所以人们不敢到沙漠中行走。黑色的格子表示山峰,这些山峰都无比高大,所以人无法穿过。白色格子代表平原,人可以在平原上自由行走。人每
2016-03-27 22:15:29
386
原创 hdu5647 DZY Loves Connecting (树形dp)
中档的树形dp题问题描述 DZY有一棵nnn个结点的无根树,结点按照1∼n1\sim n1∼n标号。DZY喜欢树上的连通集。一个连通集SSS是由一些结点组成的集合,满足SSS中任意两个结点u,vu,vu,v能够用树上的路径连通,且路径上不经过SSS之外的结点。显然,单独一个结点的集合也是连通集。一个连通集的大小定义为它包含的结点个数,DZY想知道所有连通集的大小之和是多少。
2016-03-22 12:46:07
455
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人