https://i2.wp.com/eblogarithm.com/wp-content/uploads/2016/10/Codeforces-Round-377-Div-2-problem-B-Cormen--The-Best-Friend-Of-a-Man-Solution-in-C1.png?fit=640%2C360

Codeforces Round #377 (Div. 2), problem: (B) Cormen — The Best Friend Of a Man Solution in C++

Hi guys , I just solved the Codeforces Round #377 (Div. 2), problem: (B) Cormen — The Best Friend Of a Man, hope you like it .
You are most welcome to submit any other solution .

include
using namespace std;
int main()
{
int n, walk, i, a[500], rem[500], flag, j, h, ans, temp;

cin>>n>>walk;
flag=0;
ans=0;
for(i=0,j=0; i>a[i];
if(i==0)
continue;
if((a[i]+a[i-1])=0)
{
ans += temp;
a[h] += temp;
}
if(h!=rem[i+1])
{
temp=walk-a[h]-a[h+1];
if(temp>=0)
{
ans += temp;
a[h+1] += temp;
}
}
}
}

cout<

(Visited 90 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: