2013年9月9日

摘要: 这尼吗桑心病狂的动态树:http://www.lydsy.com/JudgeOnline/problem.php?id=3153终于让哥以一种碉堡的姿势过了:牛B轰轰的最后两个都是我的。。。无法超越了。。。 阅读全文
posted @ 2013-09-09 20:20 Fatedayt 阅读(416) 评论(0) 推荐(0) 编辑

2013年8月18日

摘要: Problem DescriptionThere is a strange country somewhere which its transportation network was built following some weird rules: Consider the transportation network as a connected undirected graph G with N nodes and M edges(nodes indicate cities,and people can travel from cities to cities by roads con 阅读全文
posted @ 2013-08-18 10:16 Fatedayt 阅读(348) 评论(0) 推荐(0) 编辑

2013年7月25日

摘要: 题目大意:n个人进入商店买东西,对于每个顾客都有T、C、P这3个数组,表示有Pj的概率第i个顾客在Tj的时间进入商店以Cj的价格买东西,每个顾客Pj的和小于等于1,保证每个时间只最多只有一个顾客可能会来,每个顾客只进入商店一次。一共有swords个物品,当一个顾客进来买东西的时候,售货员可以选择卖或不卖,她以之后的最大期望进行选择。问收银额的期望是多少。解题思路:当每个顾客可能来商店的时间只有一个的时候,题目比较简单,用dp[时间][剩下物品个数]的dp方程就可以解决。当有顾客可能来商店的时间超过一个的时候,情况有点复杂,因为计算到下一个时间的时候,该顾客会不会出现的概率跟之前他有没有出现有关 阅读全文
posted @ 2013-07-25 10:36 Fatedayt 阅读(357) 评论(0) 推荐(0) 编辑

2013年7月17日

摘要: 题目大意:密码串由小写字母、大写字母和数字组成,要求求出小写字母个数不少于L个、大写字母个数不少于U个、数字个数不少于D个的长度为N密码串的种数。答案对 1000000009 取模解题思路:自己不会,看了neal_wu的代码,表示膜拜。令a表示小写字母个数,b表示大写字母个数,c表示数字个数,则a>=L,b>=U,c>=D,a+b+c=N。按照一般来讲会首先想到枚举数字个数再枚举小写字母个数,然后就用组合数求种数,这个是最自然的想法,但是时间复杂度不堪忍受。这题有个规律,因为数字比较特殊,它只有10种,而小写字母和大写字母都是26种,所以小写字母和大写字母可以一起考虑,然后用 阅读全文
posted @ 2013-07-17 18:47 Fatedayt 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 题目大意:给定一个N*M的棋盘,棋子可以攻击其左右距离不超过K的棋子。问有多少种放法使得棋盘上的棋子不能互相攻击。N,M,K都在1到1000000000的范围内,结果对100003取模。官方题解:http://apps.topcoder.com/wiki/display/tc/TCO'10+Wildcard+Round解题思路:这题行与行之间没有关系是从一开始就之间看的出来的,所以只要求出一行的种数就能搞定该题。假设一行有W个格子中放r个棋子,使得r个棋子之间的距离都超过K,做法是先全部任意的放进去,然后再往每个棋子(除了最右边的那个)右面插入K个棋子,这样就能保证棋子与棋子之间距离超 阅读全文
posted @ 2013-07-17 13:51 Fatedayt 阅读(337) 评论(0) 推荐(0) 编辑

2012年7月11日

摘要: HDU3966 Aragorn's StoryTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 605Accepted Submission(s): 160Problem DescriptionOur protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemi 阅读全文
posted @ 2012-07-11 21:57 Fatedayt 阅读(1187) 评论(4) 推荐(0) 编辑
摘要: SPOJ 2939. Query on a tree VProblem code: QTREE5You are given a tree (an acyclic undirected connected graph) with N nodes. The tree nodes are numbered from 1 to N. We define dist(a, b) as the number of edges on the path from node a to node b.Each node has a color, white or black. All the nodes are b 阅读全文
posted @ 2012-07-11 09:19 Fatedayt 阅读(764) 评论(0) 推荐(0) 编辑
摘要: SPOJ Problem Set (classical)SPOJ 1487. Query on a tree IIIProblem code: PT07JYou are given a node-labeled rooted tree withnnodes.Define the query (x,k): Find the node whose label isk-th largest in the subtree of the nodex. Assume no two nodes have the same labels.InputThe first line contains one int 阅读全文
posted @ 2012-07-11 09:14 Fatedayt 阅读(489) 评论(0) 推荐(0) 编辑

2012年7月10日

摘要: SPOJ Problem Set (classical)SPOJ 913. Query on a tree IIProblem code: QTREE2You are given a tree (an undirected acyclic connected graph) withNnodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned to it, representing its length.We will ask you to perfrom some instructions o 阅读全文
posted @ 2012-07-10 12:57 Fatedayt 阅读(733) 评论(0) 推荐(0) 编辑

2012年7月9日

摘要: SPOJ Problem Set (classical)2666. Query on a tree IVProblem code: QTREE4You are given a tree (an acyclic undirected connected graph) with N nodes, and nodes numbered 1,2,3...,N. Each edge has an integer value assigned to it(note that the value can be negative). Each node has a color, white or black. 阅读全文
posted @ 2012-07-09 22:33 Fatedayt 阅读(1323) 评论(0) 推荐(0) 编辑

导航