#P14043. [SDCPC 2019] Flipping Game

[SDCPC 2019] Flipping Game

题目描述

Little Sub loves playing the game Flip Me Please\textit{Flip Me Please}. In the game, nn lights, numbered from 1 to nn, are connected separately to nn switches. The lights may be either on or off initially, and pressing the ii-th switch will change the ii-th light to its opposite status (that is to say, if the ii-th light is on, it will be off after the ii-th switch is pressed, and vice versa).

The game is composed of exactly kk rounds, and in each round, the player must press exactly mm different switches. The goal of the game is to change the lights into their target status when the game ends.

Little Sub has just come across a very hard challenge and he cannot solve it. As his friend, it's your responsibility to find out how many solutions there are to solve the challenge and tell him the answer modulo 998244353998244353.

We consider two solutions to be different if there exist two integers ii and jj such that 1ik1 \le i \le k, 1jn1 \le j \le n and the jj-th switch is pressed during the ii-th round of the first solution while it is not pressed during the ii-th round of the second solution, or vice versa.

输入格式

There are multiple test cases. The first line of the input contains an integer TT (about 10001000), indicating the number of test cases. For each test case:

The first line contains three integers nn, kk, mm (1n,k1001 \leq n,k \leq 100, 1mn1 \leq m \leq n).

The second line contains a string ss (s=n|s| = n) consisting of only 0 and 1, indicating the initial status of the lights. If the ii-th character is 1, the ii-th light is initially on; If the ii-th character is 0, the ii-th light is initially off.

The third line contains a string tt (t=n|t| = n) consisting of only 0 and 1, indicating the target status of the lights. If the ii-th character is 1, the ii-th light must be on at the end of the game; If the ii-th character is 0, the ii-th light must be off at the end of the game.

It is guaranteed that there won't be more than 100100 test cases that n>20n > 20.

输出格式

For each test case output one line containing one integer, indicating the answer.

3
3 2 1
001
100
3 1 2
001
100
3 3 2
001
100
2
1
7

提示

For the first sample test case, Little Sub can press the 11-st switch in the 11-st round and the 33-rd switch in the 22-nd round; Or he can press the 33-rd switch in the 11-st round and the 11-st switch in the 22-nd round. So the answer is 22.

For the second sample test case, Little Sub can only press the 11-st and the 33-rd switch in the 11-st and only round. So the answer is 11.