编程介的小学生 2017-11-05 08:21 采纳率: 20.5%
浏览 730
已采纳

Board Coloring

Problem Description
HH is painting a board of size 4 * N. You can assume the color of square (X, Y) on the board is Ax,y which is an integer between 0 and 255. For the beauty of the board, HH decide to paint the board following the rules :
1) Ax,y >= Ax,y-1.
2) For some given pairs of (X1, Y1) (X2, Y2), AX1,Y1 = AX2,Y2
Your task is to calculate how many ways there are to paint the board.

Input
There are multiple test cases, the first line of input contains a single integer denoting the number of test cases.
For each test case, the first line contains an integer N and M, denoting the length of the board and the number of additional rules. (1 <= N <= 15, 0 <= M <= 100)
For next M lines, each line contains four integers X1, Y1, X2, Y2 denoting one additional rule for the painting. (1 <= X1, X2 <= 4, 1 <= Y1, Y2 <= N)

Output
For each test cases, you are to output the number of ways of painting. Because there may be too many ways, you are only to output the last five digits. See sample output for further details.

Sample Input
3
1 0
1 3
1 1 2 1
1 1 3 1
4 1 3 1
2 6
1 1 2 1
1 1 3 1
1 1 4 1
1 2 2 2
1 2 3 2
1 2 4 2

Sample Output
Case 1: 67296
Case 2: 00256
Case 3: 32896

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-29 17:06
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统