A11000 | Okabe and Banana Trees
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.
Consider the point $(x,y)$ in the 2D plane such that $x$ and $y$ are integers and $0<=x,y$ . There is a tree in such a point, and it has $x+y$ bananas. There are no trees nor bananas in other points. Now, Okabe draws a line with equation . Okabe can select a single rectangle with axis aligned sides with all points on or under the line and cut all the trees in all points that are inside or on the border of this rectangle and take their bananas. Okabe's rectangle can be degenerate; that is, it can be a line segment or even a point.
Help Okabe and find the maximum number of bananas he can get if he chooses the rectangle wisely.
Okabe is sure that the answer does not exceed $10^{18}$ . You can trust him.
Consider the point $(x,y)$ in the 2D plane such that $x$ and $y$ are integers and $0<=x,y$ . There is a tree in such a point, and it has $x+y$ bananas. There are no trees nor bananas in other points. Now, Okabe draws a line with equation . Okabe can select a single rectangle with axis aligned sides with all points on or under the line and cut all the trees in all points that are inside or on the border of this rectangle and take their bananas. Okabe's rectangle can be degenerate; that is, it can be a line segment or even a point.
Help Okabe and find the maximum number of bananas he can get if he chooses the rectangle wisely.
Okabe is sure that the answer does not exceed $10^{18}$ . You can trust him.
输入格式
The first line of input contains two space-separated integers $m$ and $b$ ( $1<=m<=1000$ , $1<=b<=10000$ ).
输出格式
Print the maximum number of bananas Okabe can get from the trees he cuts.
输入输出样例
输入 #1
1 5
输出 #1
30
输入 #2
2 3
输出 #2
25
The graph above corresponds to sample test 1. The optimal rectangle is shown in red and has $30$ bananas.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted