上师大人都知道, 上师大的猫猫非常多, 而且都很聪明. 2020年, 上师大出现了一名大一新生 - 青菜, 他十分喜欢撸猫猫, 并且会给一些猫猫带上奇怪的项圈. 喜欢简约风格的青菜拥有的项圈只有两个种类: 黑色或白色. 青菜特别喜欢黑色, 所以每次系项圈时总有猫猫会被系上黑色项圈, 猫猫自己看不到自己脖子上的颜色. 他给猫猫戴上项圈后的每天晚上都会给每一只猫一次猜自己脖子上项圈颜色的机会
上师大人都知道, 上师大的猫猫非常多, 而且都很聪明. 2020年, 上师大出现了一名大一新生 - 青菜, 他十分喜欢撸猫猫, 并且会给一些猫猫带上奇怪的项圈. 喜欢简约风格的青菜拥有的项圈只有两个种类: 黑色或白色. 青菜特别喜欢黑色, 所以每次系项圈时总有猫猫会被系上黑色项圈, 猫猫自己看不到自己脖子上的颜色. 他给猫猫戴上项圈后的每天晚上都会给每一只猫一次猜自己脖子上项圈颜色的机会. 如果猜中, 他会给这些猫猫做记录, 被记录的猫猫会在第二天早上得到从大面包中平均分出的小面包, 猫猫喜欢吃面包, 并且想要吃得多 (因此猫猫不会告诉别的猫猫对方项圈的颜色). 但是, 如果猜错一次项圈的颜色, 猫猫脖子上的项圈就会被解开, 并且记性超好的青菜永远也不会再给他系上项圈 (所有的猫猫都不希望在没有确定自己的项圈颜色的时候就去碰运气从而失去以后获取面包的权利). 当所有的猫猫都获得面包的时候, 青菜会解下所有的项圈, 并且会再给所有猫猫的一部分系上项圈, 如此往复. 问: 青菜每次给 nnn 只猫猫系上黑色项圈, 给 mmm 只猫猫系上白色项圈后的多少天, 所有猫猫都会得到面包? As every SHNUer know, there are many cats and they are all very smart. In 2020, Vege, a freshman at Shanghai Normal University, likes to masturbate cats and puts strange collars on some of them. Vege, who like simplicity, have only two types of collars: black or white, and Vege are known to love the color black, which is why cats are always wearing black collars. Cats can't see the color on their own necks. He gave each cat a chance to guess the color of its collar once a night after he put it on. If he was right, he recorded the cats, who were given smaller loaves of bread the next morning, divided equally among the larger loaves. Cats liked the loaves and wanted to eat more of them (so one cat didn't tell the others about their collar color). One wrong guess, however, unlocks the collar and Vege, who has a good memory, never puts it back on (all cats don't want to take a chance and lose the right to a loaf of bread later). When all the cats got the bread, Vege would remove all the collars and put some more collars on all the cats, and so on. Q: How many days after Vege put a black collar on n cats and a white collar on M cats will all cats get bread?
标签: HBC231163[HNOI2001]产品加工 dp的优化 动态规划 动态规划爱撸猫的青菜 - normal version题解