随笔分类 -  数论

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

posted @ 2013-07-25 10:36 Fatedayt 阅读(368) 评论(0) 推荐(0)

TCO'10 Online Round 3 1000pt
摘要:题目大意:密码串由小写字母、大写字母和数字组成,要求求出小写字母个数不少于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 阅读(363) 评论(0) 推荐(0)

TCO'10 Wildcard Round 1000pt
摘要:题目大意:给定一个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 阅读(373) 评论(0) 推荐(0)

POJ2635 The Embarrassed Cryptographer
摘要:POJ2635 The Embarrassed CryptographerTime Limit:2000MSMemory Limit:65536KTotal Submissions:8683Accepted:2231DescriptionThe young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptograp 阅读全文

posted @ 2011-11-02 20:24 Fatedayt 阅读(989) 评论(0) 推荐(0)

POJ3252 Round Numbers
摘要:POJ3252 Round NumbersTime Limit:2000MSMemory Limit:65536KTotal Submissions:4877Accepted:1664DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other 阅读全文

posted @ 2011-11-02 13:36 Fatedayt 阅读(526) 评论(0) 推荐(0)

POJ2115 C Looooops
摘要:POJ2115 C LooooopsTime Limit:1000MSMemory Limit:65536KTotal Submissions:11146Accepted:2622DescriptionA Compiler Mystery: We are given a C-language style for loop of typefor (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to value A and while vari. 阅读全文

posted @ 2011-10-30 20:14 Fatedayt 阅读(549) 评论(0) 推荐(0)

FZU1607 Greedy division
摘要:FZU1607 Greedy divisionAccept: 317Submit: 1248Time Limit: 1000 mSecMemory Limit : 32768 KBProblem DescriptionOaiei has inherited a large sum of wealth recently; this treasure has n pieces of golden coins. Unfortunately, oaiei can not own this wealth alone, and he must divide this wealth into m parts 阅读全文

posted @ 2011-10-29 19:29 Fatedayt 阅读(252) 评论(0) 推荐(0)

导航