CF821B.Okabe and Banana Trees
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 1018. You can trust him.
Okabe 出于某种奇怪的原因,需要香蕉来进行一项实验。因此,他决定前往森林砍伐香蕉树。
考虑二维平面上的点 (x,y),其中 x 和 y 均为整数,且满足 0≤x,y。在每个这样的点上都有一棵香蕉树,该树结有 x+y 根香蕉;其余位置既无香蕉树,也无香蕉。现在,Okabe 画出一条直线,其方程为
。Okabe 可以选择一个边与坐标轴平行的矩形区域,要求该矩形的所有点均位于该直线上或其下方(即满足 y≤−mx+b),并砍伐该矩形内部及边界上的所有香蕉树,从而获得它们所结的全部香蕉。Okabe 所选的矩形可以是退化的,即它可以是一条线段,甚至只是一个点。
请帮助 Okabe 计算:若他能明智地选择该矩形,则最多能获得多少根香蕉?
Okabe 确信答案不会超过 1018。你可以相信他。
输入格式
The first line of input contains two space-separated integers m and b (1 ≤ m ≤ 1000, 1 ≤ b ≤ 10000).
输入的第一行包含两个以空格分隔的整数 m 和 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.

上图对应样例测试 1。最优矩形用红色标出,共包含 30 根香蕉。
输入解题思路,AI测评打分。不知道怎么写?