当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3718:Facer's Chocolate Dream

题目描述
"It is so sweet to have chocolates on St. Valentine's Day!" Little Facer was so excited when he receives a box of self-made chocolates from his girlfriend, and he decided to eat these chocolates in a special way to commemorate this important day. Suppose that there are N types of chocolates in the box, it can be easily calculated that there are totally __poj_jax_start__{{n}\choose{3}}__poj_jax_end__{{n}\choose{3}} different combinations if we choose 3 chocolates of different types to make a dish. Facer will first make one dish for every of these combination, so there will be __poj_jax_start__{{n}\choose{3}}__poj_jax_end__{{n}\choose{3}} dishes in all with 3×__poj_jax_start__{{n}\choose{3}}__poj_jax_end__{{n}\choose{3}} chocolates totally. Then both Facer and his girlfriend choose some chocolates of different types as their original chocolates set. After that, Facer choose exactly M dishes of three-type-mixed-chocolates which he made in the first step and add them into his original chocolates set. Finally, Facer continues eatting two chocolates of the same type until he cannot find any pair of chocolates of the same type (which means for each type of chocolates, there remains at most one chocolate). Facer wishes that his remaining chocolates set could be identical with his girlfriend's original chocolates set after the steps mentioned above, but he does not know the number of ways to choose dishes. Could please tell him the answer?
输入解释
The input consists of multiple test cases. Each test case starts with two integers, N and M, which are the number of different types of chocolates and the number of three-type-mixed-chocolates dishes Facer will choose, it is guaranteed that 1≤N≤1000, 0≤M≤1000. The following two lines contain one N-bit binary integer each, which represents Facer's and his girlfriend's original chocolates set. A case with N=0 and M=0 indicates the end of the input file, which should not be processed.
输出解释
For each test case, print one line containing one single integer, which represents the total number of ways to choose dishes. Since the number can be extremely big, you are only required to output the answer % 10007.
输入样例
4 3
1101
1001
3 1
101
010
5 3
11010
10111
0 0
输出样例
1
1
6
提示
This problem is inspired from 2008 Regional Hangzhou but is more difficult.
A naive print-table-algorithm will not pass.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3718

最后修改于 2020-10-29T07:09:01+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536