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

Solution on C#
Posted by Smith 20 Jan 2009 01:13
using System;

class Entrypiont
{
    static void Main()
    {
        string[] Input = Console.ReadLine().Split(' ');
        int Sickness = Convert.ToInt32(Input[0]);
        int Pereplet = Convert.ToInt32(Input[1]);
        int Start = Convert.ToInt32(Input[2]);
        int Finish = Convert.ToInt32(Input[3]);

        int totalSickness = Sickness + Pereplet * 2;

        int way = 0;
        if ((Finish - Start) > 0)
        {
            int bookCount = Math.Abs(Finish - Start) - 1;
            way = totalSickness * bookCount + 2*Pereplet;
        }
        else if ((Finish - Start) < 0)
        {
            int bookCount = Math.Abs(Finish - Start) - 1;
            way = totalSickness * bookCount + 2 * (Pereplet + Sickness);
        }
        else
        {
            way = Sickness;
        }

        Console.Write(way);
    }
}
Re: Solution on C#
Posted by dAFTc0d3r [Yaroslavl SU] 25 Mar 2010 01:15
it's very bad to post here AC solutions ;D
Re: Solution on C#
Posted by dAFTc0d3r [Yaroslavl SU] 25 Mar 2010 01:20
...especially when they are far far away from ideal =)
Re: Solution on C#
Posted by [TDUweAI] daminus 25 Jun 2013 20:42
thanks, because I'm not understand this problem/// :)