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 1910. Titan Ruins: Hidden Entrance

My succesfull C# code!!!
Posted by Jamshid Ideal 28 Jan 2013 23:25
using System;
static class Module1
{
    public static void Main()
    {
        short n = short.Parse(Console.ReadLine());
        string[] a = Console.ReadLine().Split();
        int i = 0;
        int temp = 0;
        int max = 0;
        int numb = 0;
        while (i + 3 <= n)
        {
            temp = int.Parse(a[i]) + int.Parse(a[i + 1]) + int.Parse(a[i + 2]);
            if (temp > max)
            {
                max = temp;
                numb = i + 2;
            }
            i += 1;
        }
        Console.WriteLine(max + " " + numb);
    }
}