|
|
back to boardSolution 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# it's very bad to post here AC solutions ;D Re: Solution on C# ...especially when they are far far away from ideal =) Re: Solution on C# thanks, because I'm not understand this problem/// :) |
|
|