
ZOJ Problem Set  4114
Little Sub loves playing the game Flip Me Please. In the game, $n$ lights, numbered from 1 to $n$, are connected separately to $n$ switches. The lights may be either on or off initially, and pressing the $i$th switch will change the $i$th light to its opposite status (that is to say, if the $i$th light is on, it will be off after the $i$th switch is pressed, and vice versa). The game is composed of exactly $k$ rounds, and in each round, the player must press exactly $m$ 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 998244353. We consider two solutions to be different if there exist two integers $i$ and $j$ such that $1 \le i \le k$, $1 \le j \le n$ and the $j$th switch is pressed during the $i$th round of the first solution while it is not pressed during the $i$th round of the second solution, or vice versa. InputThere are multiple test cases. The first line of the input contains an integer $T$ (about 1000), indicating the number of test cases. For each test case: The first line contains three integers $n$, $k$, $m$ ($1 \leq n,k \leq 100$, $1 \leq m \leq n$). The second line contains a string $s$ ($s = n$) consisting of only '0' and '1', indicating the initial status of the lights. If the $i$th character is '1', the $i$th light is initially on; If the $i$th character is '0', the $i$th light is initially off. The third line contains a string $t$ ($t = n$) consisting of only '0' and '1', indicating the target status of the lights. If the $i$th character is '1', the $i$th light must be on at the end of the game; If the $i$th character is '0', the $i$th light must be off at the end of the game. It is guaranteed that there won't be more than 100 test cases that $n > 20$. OutputFor each test case output one line containing one integer, indicating the answer. Sample Input3 3 2 1 001 100 3 1 2 001 100 3 3 2 001 100 Sample Output2 1 7 HintFor the first sample test case, Little Sub can press the 1st switch in the 1st round and the 3rd switch in the 2nd round; Or he can press the 3rd switch in the 1st round and the 1st switch in the 2nd round. So the answer is 2. For the second sample test case, Little Sub can only press the 1st and the 3rd switch in the 1st and only round. So the answer is 1. Author: CHEN, Jingbang Source: The 10th Shandong Provincial Collegiate Programming Contest 