编程介的小学生 2017-11-24 09:38 采纳率: 20.5%
浏览 723
已采纳

Bear-Baby

Problem Description
Bear-Baby is a smart boy and he likes playing games. One day he played a simple game with one guy. In this game there are N piles of stones, and each of these piles has K stones at first. When the game starts, two participants take turns to pick up stones following this rule: the one who should act now must choose two different piles (e.g. , pile i and j, i≠j ), and remove the same number of stones from these two piles. The one who cannot act loses the game. Now Bear-Baby wants to study the game. He’d like to figure out the Sprague-Grundy value of each situation that will appear during the game.
Given the number of the piles N and the size of each pile K, Bear-Baby wonders how many different situations could appear during the game. We consider that two situations are the same if they are same after reorder the piles, i.e situations (1,1,3) (1,3,1) and (3,1,1) are the same.

Input
There is an integer T(T<=100) in the first line indicating the number of test cases.
In each test case there are two numbers N and K (1<=N,K<=100) telling the number of piles and the size of each pile in one line.

Output
For each test case: output the case number as shown and print the number of different situations in one line. The answer may be a very large number, so print the answer modulo 1000000007.

Sample Input
2
2 3
3 2

Sample Output
Case #1: 4
Case #2: 5

  • 写回答

1条回答 默认 最新

  • threenewbee 2018-05-22 15:36
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误