ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1638. Bookworm

Ни как не могу понять что тут не правильно. Помогите пожалуйста
Posted by Vahagn97 9 Feb 2013 23:41
#include <iostream>
using namespace std;
int main()
{

    int a,b,c,d,n;
    cin >> a >> b >> c >> d;
    if (c<d)
    {
        n=d-c;
        n=a*(n-1)+b*(n+1);
    }
    else {
        n=c-d;
        n=a*(n+1)+a*(n+1);
    }
    cout  << n;
    return 0;
}
Re: Ни как не могу понять что тут не правильно. Помогите пожалуйста
Posted by Максим 20 Dec 2017 22:22
in "else" you should use "b" instead of second "a".

Edited by author 20.12.2017 22:24