#P11571. 「chaynOI R1 T4」橙红色的鱼

「chaynOI R1 T4」橙红色的鱼

Background

Problem Description

Given r,m,sr, m, s, ask how many pairs of positive integers (fi,sh)(fi, sh) satisfy:

  • 0fishr0 \le fi \le sh \le r.

  • popcount(fish)=m\operatorname{popcount}(fi \oplus sh) = m.

  • popcount(fi+sh)=s\operatorname{popcount}(fi + sh) = s.

Here, popcount(x)\operatorname{popcount}(x) denotes the number of 11's in the binary representation of xx, and \oplus denotes the XOR operation.

For convenience, rr is given in binary.

It is guaranteed that none of the given numbers has leading 00.

Output the answer modulo 998244353998244353.

Input Format

One line with three integers r,m,sr, m, s.

Output Format

One line with one integer, the answer modulo 998244353998244353.

111 1 2 
6

Hint

Sample Explanation:

All numbers below are in decimal.

When r=7r = 7, there are six pairs: (1,5),(2,3),(3,7),(4,5),(4,6),(5,7)(1,5), (2,3), (3,7), (4,5), (4,6), (5,7).

Constraints:

Let nn be the length of the given rr.

For 100%100\% of the data, 1n,m,s2001 \le n, m, s \le 200.

This problem uses bundled testdata.

  • Subtask 1 (15 pts): n12n \le 12.
  • Subtask 2 (25 pts): m,s30m, s \le 30.
  • Subtask 3 (25 pts): r=2n1r = 2^n - 1.
  • Subtask 4 (35 pts): no special constraints.

Translated by ChatGPT 5