#P2638. 安全系统

安全系统

Description

After Tesla’s six-digit passcode was easily cracked, people began to doubt the security of electric vehicles. Upon hearing this, Li Hua designed his own passcode system:

  • Suppose the security system has nn storage units. Each storage unit can hold up to 2 different types of signals (it may also hold none). There are two types of signals, 00 and 11, with aa copies of 00 and bb copies of 11 available. A single 00 or 11 counts as one signal. We need to store these signals in the storage units. The 00 and 11 signals do not have to be all stored; a storage unit may contain any number of 00’s and any number of 11’s. Every distinct storage plan, after Li Hua’s processing, will correspond to a distinct passcode.

Given n,a,bn,a,b, find the number of possible distinct storage plans.

Input Format

The first line contains 3 integers, n,a,bn,a,b.

Output Format

The first line contains an integer, the number of plans.

2 1 1
9

Hint

All 9 plans are as follows:

Storage unit 11 Storage unit 22
NULL\verb!NULL! NULL\verb!NULL!
00
11
NULL\verb!NULL! 00
11
0,10,1 NULL\verb!NULL!
NULL\verb!NULL! 0,10,1
11 00
00 11

Constraints: For all testdata, a,b50a,b \le 50, n+a50n+a \le 50, n+b50n+b \le 50.


upd 2022.10.22\text{upd 2022.10.22}: A new set of Hack testdata was added.

Translated by ChatGPT 5