blob: 16ef0ff332b3d096072150619b73e6a29306ecc3 (
plain) (
blame)
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
37
|
using System;
using System.IO;
using System.Linq;
namespace AOC
{
internal class Run
{
private static int PartOne(int[] data)
{
int prev = 0, three = 1, one = 0;
for (int i = 0; i < data.Length; i++)
{
if (data[i] - prev == 3) three++;
else one++;
prev = data[i];
}
return one * three;
}
private static int PartTwo(int[] data)
{
return 0;
}
public static void Main(string[] args)
{
string text = File.ReadAllText(@"C:\Users\bornerma\Desktop\input.txt");
string[] numsStr = text.Split('\n');
int[] nums = Array.ConvertAll(numsStr, int.Parse).OrderBy(i => i).ToArray();
Console.WriteLine(PartOne(nums));
Console.WriteLine(PartTwo(nums));
}
}
}
|