Sunday, August 10, 2008

ural1025


using System;
using System.Collections.Generic;
using System.Text;
using System.IO;


class Program
{
static void Main(string[] args)
{
problem p = new problem();
}
}

class RTIO
{
static string bufferStr = "";
public static int GetInt()
{
if (bufferStr.Length == 0)
{
bufferStr = Console.ReadLine();
}
int index = bufferStr.IndexOf(' ');
if (index < 0) index = bufferStr.Length;

int res = int.Parse(bufferStr.Substring(0, index));
if (index != bufferStr.Length)
{
bufferStr = bufferStr.Remove(0, index + 1);
}
else
{
bufferStr = "";
}
return res;
}
public static string GetString()
{
if (bufferStr.Length == 0)
{
bufferStr = Console.ReadLine();
}
string res = bufferStr;
bufferStr = "";
return res;
}
}

class problem
{
public problem()
{
int n = RTIO.GetInt();
int[] groups = new int[n];
for (int i = 0; i < n; i++)
{
groups[i] = RTIO.GetInt();
}
Array.Sort(groups);
int res = 0;
for (int i = 0; i < n / 2 + 1; i++)
{
res += groups[i] / 2 + 1;
}
Console.WriteLine(res);
}
}

No comments: