https://i2.wp.com/eblogarithm.com/wp-content/uploads/2017/08/Codeforces-Round-420-Div-2-problem-B-Okabe-and-Banana-Trees-Solution-In-CC1.png?fit=640%2C360

Codeforces Round #420 (Div. 2), problem: (B) Okabe and Banana Trees Solution In C/C++

#include <iostream>
using namespace std;
int main(){
long long int m,b,s=0,x;
cin>>m>>b;
for(int i=0;i<=b;i++){
x=(b-i)*m;
s=max(s,((i+1)*(x+1)*(i+x))/2);
}
cout<<s;

}

(Visited 12 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: