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

Do you wanna know what is WA5?
Posted by Hikmat 20 Aug 2011 14:56
Answer: Start Volume Number > Stop Volume Number
You assume that worm start at lower volume and stops at higher volume but DO NOT.

Here is a code in C#:

using System;
class Program
{
    static void Main()
    {
        string[] ss = Console.ReadLine().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        int Thickness = int.Parse(ss[0]);
        int CoverThickness = int.Parse(ss[1]);
        int Start = int.Parse(ss[2]);
        int Finish = int.Parse(ss[3]);
        int route = Math.Abs((Finish - Start - 1) * (Thickness + 2 * CoverThickness) + 2 * CoverThickness);
        Console.WriteLine(route);
    }
}