高斯练刀工

高斯练刀工

Background

One day, on a whim, Gauss decided to practice knife work (to defend against elves). So he pulled out N sharp knives from his waist and decided to cut a piece called "plane" into thin pieces first ...

有一天,高斯心血来潮,决定练习练习刀工(目的是防御小精灵),于是他从腰间拔出\(n\)把锋利的刀,决定先将一个叫“平面”的东西剪得稀碎稀碎的……

Description

There are n(n≤500) knives in the same plane. given that p(p≥2) knives intersect at the same point, how many different regions can the n knives divide the plane into at most?

同一平面内有 \(n(n≤500)\) 把刀,已知其中 \(p(p≥2)\)把刀相交于同一点,则这 \(n\) 把刀最多能将平面分割成多少个不同的区域?

Input

Two integers n(n≤500) and p(2≤p≤n).

两个整数 \(n(n≤500)\)和 \(p(2≤p≤n)\)。

Output

A positive integer that represents the maximum number of regions divided into.

一个正整数,代表最多分割成的区域数目。

Input

12 5

Output

73

Limitation

\(n≤500\)
\(2≤p≤n\)

Source

Amorphophallus Orz Group

信息

ID
1008
难度
2
分类
数学 点击显示
标签
递交数
11
已通过
3
通过率
27%
上传者

相关

在下列训练计划中:

AOG题库训练计划