mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-10-14 08:18:09 +00:00
[Init] Solved solutions
This commit is contained in:
1 parent
51f667ac81
commit
20542601dd
131 files changed
+4148
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
|
||||
namespace problem_158B
|
||||
{
|
||||
class problem_158B
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int n = int.Parse(Console.ReadLine());
|
||||
int[] a = new int[4];
|
||||
int[] ip = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
a[ip[i] - 1]++;
|
||||
}
|
||||
int c = a[3];
|
||||
c += a[2];
|
||||
a[0] -= a[2];
|
||||
if (a[0] < 0)
|
||||
{
|
||||
a[0] = 0;
|
||||
}
|
||||
c += a[1] / 2;
|
||||
a[1] %= 2;
|
||||
a[0] += 2 * a[1];
|
||||
c += a[0] / 4;
|
||||
if (a[0] % 4 != 0)
|
||||
{
|
||||
c++;
|
||||
}
|
||||
Console.Write(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user