Nunchucks Shop | 프로그래밍의 벗 PivotOJ
PivotOJ

Nunchucks Shop

시간 제한: 2000ms메모리 제한: 512MB출처: ICPC 2020-2021 Northwestern Russia Regional ContestBOJ 20245
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

Nathan owns a shop that sells souvenir nunchucks with unique design. Nunchucks is a traditional martial arts weapon consisting of two sticks connected with a chain. In Nathan's design, each stick is inlayed with nn gemstones arranged in a row. These gemstones are either quartz or onyx, and they create a nice black-and-white pattern. For aesthetics reasons, Nathan sells only nunchucks with exactly kk onyxes on both sticks in total. For example, here is one of the possible designs for n=4n=4 and k=5k=5.

[이미지 1]

Recently Nathan decided that it will be good to be able to sell nunchucks with every possible design. But that will require him to have nunchucks with all possible designs in the storage, and the number of possible designs is huge! 

Thus, Nathan decided to compromise. He will have a number of sticks in his storage. When a customer orders some design, Nathan will take two sticks from the storage and combine them with a chain. Sticks are symmetrical, and Nathan can connect the chain to any end of the stick. For example, if n=3n=3 and k=2k=2, and Nathan has these sticks in the storage:

[이미지 2]

Then he can make nunchucks of any possible design. For example, if the customer asks for nunchucks of this design:

[이미지 3]

Then Nathan can make it from sticks 1 and 3.

Now Nathan wonders: what is the minimum number of sticks he should have in the storage to be able to make nunchucks of any possible design? Help him find this number.

입력

The input contains two integers nn and kk (1n501\le n\le 50; 0k2n0\le k\le 2\cdot n).

출력

Output one integer: the minimum number of sticks Nathan should have in the storage.

예제

예제 1

입력
3 2
출력
7

예제 2

입력
4 1
출력
3

예제 3

입력
5 0
출력
2

예제 4

입력
50 50
출력
626155273417404
코드를 제출하려면 로그인하세요.