题目大意是给出价值分别为1到6的石头的个数,问能否将其平分使价值总和相等。
朴素的0/1背包模型模型即可AC。有两个显而易见的优化:
- 所有石头的价值总和为奇数则必然不可能平分
- 判断能否平分只需判断能否用已有的石头组合出所有石头价值总和的一半的即可
个人感觉可以利用数论证明将石头个数缩小到一定范围仍然不影响结果,但由于用了以上两个优化的效果已经非常好了,所以就没有进一步去证明了。
3068626 2008-09-13 16:19:32 Accepted 1149 FPC 00:00.00 520K IwfWcf
该题好像是用中国剩余定理来缩小范围。
回复删除即读入时mod一个数(可能是最小公约数?)
这样数组开到1000即可,时间也效果显著。
可惜看了《算法导论》半天,被他的同余搞得一塌糊涂了。。
问一下,你的朴素是怎么过的?
第一个优化很明显,第二个本来就是用来DP的,但我还是无奈的TLE。。
还有。。zju是不是down了?
ZOJ在升级,从昨天18:00开始,会在48小时内完成
回复删除我的程序实现没有什么特别的,就是朴素的0/1背包罢了,要说算得上优化的也就是判断一下当前价值是否已经标记过了,如果是则代表其后的相应倍数也必然标记过了,不需要做重复的标记了。
我回去试试再改改。。你那个站内搜索怎么弄的?
回复删除Blogger Draft的页面元素
回复删除qihang0922,instyler max
回复删除tory burch outlet
ralph lauren outlet
gucci borse
jordan pas cher
ugg boots
longchamp handbags
air max
mulberry handbags
timberland boots
uggs on sale
mont blanc
fitflops sale clearance
michael kors handbags
air max 90
ugg sale
louis vuitton pas cher
replica watches
burberry outlet
ugg boots clearance
ugg outlet
fake oakleys
nike tn
pandora jewelry
louboutin
christian louboutin uk
hermes uk
cheap uggs
cheap jerseys
toms shoes
kate spade handbags
gucci shoes
michael kors
nike air force 1
nike air huarache
ray ban outlet
adidas superstar
tod's shoes
q
toms outlet, http://www.tomsoutlet-stores.com/
回复删除nike roshe, http://www.nikerosherunshoes.co.uk/
prada handbags, http://www.pradahandbagsoutlet.co.uk/
soccer jerseys, http://www.cheapsoccerjersey.net/
michael kors outlet store, http://www.michaelkorsoutlet-store.us.com/
true religion jeans, http://www.truereligionjeansoutlets.us.com/
oakley sunglasses, http://www.oakleysunglasses-outlet.us.com/
nike free 5, http://www.nikefree5.us/
louis vuitton bags, http://www.louisvuittonbag.us.com/
chanel handbags, http://www.chanelhandbags-outlet.co.uk/
chanel handbags, http://www.chanelhandbags-outlet.us.com/
louis vuitton handbags, http://www.louisvuittonhandbag.us/
louis vuitton outlet, http://www.louisvuittonoutlet.in.net/
ghd hair straighteners, http://www.ghdhairstraightenerssale.co.uk/
nba jerseys, http://www.nbajerseys.us.com/
coach outlet, http://www.coachoutletstores.com.co/
true religion jeans, http://www.truereligionjeanscanada.com/
swarovski crystal, http://www.swarovskicrystals.co.uk/
mbt shoes, http://www.mbtshoesoutlet.us.com/
michael kors handbags, http://www.michaelkorshandbags.in.net/
chanel handbags, http://www.chanelhandbagsoutlet.in.net/
michael kors outlet online, http://www.michaelkorsoutletonline.in.net/
polo ralph lauren, http://www.poloralphlauren.us.org/
the north face clearance, http://www.thenorthfaceclearances.us.com/
jordan shoes, http://www.jordan-shoes.us.com/
beats by dr dre, http://www.beatsbydrdre-headphones.us.com/
the north face uk, http://www.thenorthfaces.org.uk/
1003maoqiuyun
nike roshe run shoes
回复删除coach outlet online
ray ban glasses
gucci handbags online
true religion outlet store
mcm handbags
toms shoes
louis vuitton outlet online
canada goose uk
cheap jordan shoes
201612.26chenjinyan
ugg boots
回复删除versace jeans
air jordan uk
ralph lauren
nike factory outlet
ugg boots
air jordan uk
nike outlet
oakley sunglasses
snapbacks wholesale
coach outlet
回复删除coach outlet online
hermes handbags bag
michael kors handbags outlet
louboutin shoes
nike air force 1
birkin bag
golden gooses
fila shoes
adidas yeezy