- 博客(314)
- 资源 (1)
- 收藏
- 关注
原创 Problem 1581 - Union of cubes+武大校赛+线段树维护
题目 http://acm.whu.edu.cn/land/problem/detail?problem_id=1581题意:在一个三维空间里,有N*(K*N)*(K*K*N)个点,每个点有一定的值,然后有M个长方体,每个长方体以固定位置((x1,y1,z1)(x2,y2,z2)为对角位置,其中(x1code:#include #include#includeusing namesp
2015-04-30 16:50:15
650
1
转载 结构体对齐详解
原文地址:http://www.cnblogs.com/motadou/archive/2009/01/17/1558438.html结构体对齐详解1 -- 结构体数据成员对齐的意义许多实际的计算机系统对基本类型数据在内存中存放的位置有限制,它们会要求这些数据的起始地址的值是某个数k的倍数,这就是所谓的内存对齐,而这个k则被称为该数据类型的对齐模数(alig
2015-04-28 20:14:01
424
原创 uva 11008 Antimatter Ray Clearcutting 状态压缩+记忆化搜索
uva 11008 Antimatter Ray Clearcutting dp思路:由于只有16棵树,所以可先预处理出可以一刀切的树的集合,stay_aline[i][j]沿着ij数切,所切的树的集合,可用一个32位大的数来表示,最低位是第0棵树,0表示不再这个集合中,1表示在,然后在用上三点共线的公式就可以处理出来了。记忆化搜索也是应用上了状态压缩,每次选两棵不同的数来切,除掉能切掉的数,
2015-03-03 12:29:31
546
原创 uva 10913 Walking on a Grid
uva 10913 Walking on a Grid解决方案:dp思路:有四个状态,x,y(位置),ck(走了多少个负数),d(从哪个方向走过了,下,左,右),然后记忆化搜索code:#include #include#includeusing namespace std;const int maxn=100;const long long inf=-0x3f3f3f3f3f3
2015-03-03 12:27:15
561
原创 uva 10604 Chemical Reaction 记忆化搜索
uva 10604 Chemical Reaction解决方案:dp思路:记忆化搜索,这题只有六种化学药品,可以开一个六维的数组进行dp,dp[a1][a2][a3][a4][a5][a6],a1...a6分别表示这六种药品剩余多少,然后选两种药品进化学反应(可以使同样类型的药品),进入下一状态进行搜索,每个状态由下一状态决定其最优值。code:#include #include#in
2015-03-03 10:12:01
533
原创 uva607 Scheduling Lectures+uva+dp
uva 607 Scheduling Lectures解决方案:dp思路:dp[i]代表上了前面i个topic用的课时最少数,D[i]代表上了前面i个topic的最低不满意度; dp状态转移:dp[i]=min(dp[i],dp[j-1]+1),j>=1&&jcode:#include #include#includeusing namespac
2015-03-03 10:06:20
457
原创 uva 10118 Free Candies+记忆化搜索
uva 10118 Free Candies解决方案:dp思路为:dp[a1][a2][a3][a4]表示当取四堆的a1、a2、a3、a4之后最多获得多少对糖,由于只有20种糖,可以开一个20大的数组表示当前篮子中的存在不存在这种糖(只存不同的糖,相同的收回口袋),用cnt来记录篮子中的糖的个数,若cnt==5,且没有相同的糖,则dp[a1][a2][a3][a4]=0,表示当前状态无法再取,
2015-03-02 22:50:49
558
原创 VK Cup 2012 Qualification Round 2--E. Zebra Tower 离散化+优先队列
E. Zebra Towertime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Janet likes playing with cubes. Act
2015-01-26 21:41:38
512
原创 Codeforces Round #105 (Div. 2)--E. Porcelain 01背包
E. Porcelaintime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring her tantrums the princess usually smash
2015-01-26 21:30:37
639
原创 Codeforces Round #105 (Div. 2)—Bag of mice 概率期望dp
D. Bag of micetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe dragon and the princess are arguing abou
2015-01-26 21:03:40
364
原创 Codeforces Round #287 (Div. 2) C. Guess Your Way Out!+二叉树
C. Guess Your Way Out!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr bought a new video game "Guess Yo
2015-01-25 00:17:30
510
原创 Codeforces Round #285 (Div. 2) C. Misha and Forest
C. Misha and Foresttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's define a forest as a non-directed
2015-01-23 13:18:21
452
原创 Codeforces Round #286 (Div. 2) C. Mr. Kitayuta, the Treasure Hunter+dp+优化
从后往前dp,必须优化维度
2015-01-22 10:32:07
757
原创 Codeforces Round #286 (Div. 2) B. Mr. Kitayuta's Colorful Graph +foyd算法的应用
B. Mr. Kitayuta's Colorful Graph求不同颜色路径的个数,Floyd算法的应用。
2015-01-22 10:11:57
776
原创 Triangle Counting+uva+数学题
Problem GTriangle CountingInput: Standard InputOutput: Standard Output You are given n rods of length 1, 2…, n. You have to pick any 3 of them & build a triangle. How many distinct triangl
2014-12-29 22:27:16
639
原创 A Simple Problem with Integers+hdu+树状数组
A Simple Problem with IntegersTime Limit: 5000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3924 Accepted Submission(s): 1213Problem Descriptio
2014-12-14 22:20:39
648
原创 A Simple Problem with Integers+poj+splay树区间操作
A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 66557 Accepted: 20467Case Time Limit: 2000MSDescriptionYou have N i
2014-12-12 23:03:18
453
原创 Buying Coke +uva+记忆化搜索
Problem DBuying Coke Input: Standard InputOutput: Standard OutputTime Limit: 2 SecondsI often buy Coca-Cola from the vending machine at work. Usually I buy several cokes at once, since my wo
2014-12-12 22:19:21
583
原创 Play with Chain+hdu+splay树的基本操作
Play with ChainTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4043 Accepted Submission(s): 1649Problem DescriptionYaoYao is fond
2014-11-23 21:31:42
487
原创 LOOPS+hdu+简单概率期望dp
LOOPSTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 2662 Accepted Submission(s): 1100Problem DescriptionAkemi Homura is a Maho
2014-11-23 15:56:57
477
原创 Collecting Bugs+POJ 2096+概率期望dp
Collecting BugsTime Limit:10000MS Memory Limit:64000KB 64bit IO Format:%I64d & %I64uDescriptionIvan is fond of collecting. Unlike other people who collect post stamps, coins
2014-11-20 18:23:53
485
原创 棋盘问题+POJ+dfs搜索题
棋盘问题Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 23340 Accepted: 11569Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求
2014-11-18 19:38:11
654
原创 Balancing Act+POJ+树形dp
Balancing ActTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9199 Accepted: 3826DescriptionConsider a tree T with N (1 <= N <= 20,000) nodes numbered 1.
2014-11-15 22:01:43
598
原创 Anniversary party+hdu+树形dp+水之
Anniversary partyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5303 Accepted Submission(s): 2447Problem DescriptionThere is
2014-11-15 20:40:04
492
原创 Paths through the Hourglass+uva+dp
Paths through the HourglassInput: Standard InputOutput: Standard OutputTime Limit: 2 SecondsIn the hourglass to the right a path is marked. A path always starts at the first row and ends at
2014-11-15 11:06:32
449
原创 Forming Quiz Teams+uva+状态压缩
4thIIUCInter-University Programming Contest, 2005GForming Quiz TeamsInput: standard inputOutput: standard outputProblemsetter: Sohel HafizYou ha
2014-11-11 12:23:07
496
原创 Injured Queen Problem+uva+dp
Injured Queen ProblemInput: standard inputOutput: standard outputTime Limit: 6 secondsMemory Limit: 32 MB Chess is a two-player board game believed to have been played in India as early as
2014-11-09 00:04:23
409
原创 Strategic Game+hdu+树形dp
Strategic GameTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5148 Accepted Submission(s): 2368Problem DescriptionBob enjoy
2014-11-08 10:47:54
441
原创 Join the Conversation
#include #include#include#includeusing namespace std;char input[2000];char name[2000];char mention[2000];int dp[600000];int fa[600000];int path[600000];mapMax;mapkey;int main
2014-11-03 23:41:06
2096
原创 Pay the Price+uva+dp
Pay the PriceInput: standard inputOutput: standard outputTime Limit: 2 secondsMemory Limit: 32 MB In ancient days there was a country whose people had very interesting habits. Some of them
2014-11-01 15:10:15
684
原创 Clock Splitter+uvalive+二分
Clock SplitterAn analogue clock has the first twelve natural numbers placed in an equally spaced fashion in a clockwisedirection on its face. It is possible to draw one line across this regular cl
2014-10-31 17:56:50
421
原创 Edit Step Ladders+uva+简单dp
Problem C: Edit Step LaddersAn edit step is a transformation from one word x to another word y such that x and y are words in the dictionary, and x can be transformed to y by adding, del
2014-10-28 10:05:10
567
原创 Make Palindrome+uva+回文串dp
Problem AMake PalindromeInput: standard inputOutput: standard outputTime Limit: 8 seconds By definition palindrome is a string which is not changed when reversed. "MADAM" is a nice example
2014-10-26 12:32:26
399
原创 Adventures in Moving - Part IV+uva+dp
Adventures in Moving - Part IVTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluDescriptionProblem A: Adventures in Moving - Part IVT
2014-10-25 22:06:02
487
原创 Hatsune Miku+hdu+鞍山区域赛+简单dp
NEW~ 关于举办计算机学院大学生程序设计竞赛(2014'11)的报名通知Hatsune MikuTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 100 Accepted Submission(s)
2014-10-23 00:03:51
807
原创 Weights and Measures+uva+一般dp
Problem F: Weights and MeasuresI know, up on top you are seeing great sights, But down at the bottom, we, too, should have rights. We turtles can't stand it. Our shells will all crack! Besides
2014-10-21 12:12:03
424
原创 Again Palindromes+uva+回文串dp
Problem IAgain PalindromesInput: Standard InputOutput: Standard OutputTime Limit: 2 Seconds A palindorme is a sequence of one or more characters that reads the same from the left as it doe
2014-10-21 12:02:37
468
原创 Chopsticks+uva+一般dp
Problem CChopsticksInput: Standard InputOutput: Standard OutputIn China, people use a pair of chopsticks to get food on the table, but Mr. L is a bit different. He uses a set of three ch
2014-10-19 08:50:24
385
原创 Optimal Binary Search Tree+区间dp+uva
Problem EOptimal Binary Search TreeInput: standard inputOutput: standard outputTime Limit: 30 secondsMemory Limit: 32 MBGiven a set S = (e1, e2, ..., en) of n distinct elements such that e
2014-10-18 10:01:26
421
原创 String to Palindrome+uva+回文串dp
Problem HString to PalindromeInput: Standard InputOutput: Standard OutputTime Limit: 1 Second In this problem you are asked to convert a string into a palindrome with minimum number of ope
2014-10-11 20:22:24
425
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人