-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA. Keyboard.cs
36 lines (30 loc) · 937 Bytes
/
A. Keyboard.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication17
{
class Program
{
static void Main(string[] args)
{
var gr = int.Parse(Console.ReadLine());
var groups = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
int count = 0;
List<int> index = new List<int>();
groups.Sort();
var taxi = groups.GroupBy(i => i).Select(g => g.Count()).ToList();
if (taxi[1] % 2 == 0)
count += taxi[1] / 2;
else
count += taxi[1] / 2 + 1;
if ((taxi[0] + taxi[2] * 3) % 4 == 0)
count += (taxi[0] + taxi[2] * 3) / 4;
else
count += ((taxi[0] + taxi[2] * 3) / 4) + 1;
count += taxi[3];
Console.WriteLine(count);
Console.ReadLine();
}
}
}