day one part one

This commit is contained in:
2025-12-01 13:20:37 -05:00
parent 613731a196
commit 990a5900f7
2 changed files with 28 additions and 1 deletions

View File

@@ -1 +1,6 @@
Console.WriteLine("Advent of Code 2025");
using AdventOfCode2025;
Console.WriteLine("Advent of Code 2025");
var dayOneInput = await File.ReadAllTextAsync("./Input/DayOne.txt");
AdventSolver<SecretEntrance>.Solve(dayOneInput, 1, "Secret Entrance");

View File

@@ -0,0 +1,22 @@
namespace AdventOfCode2025;
public class SecretEntrance : IAdventSolution
{
public AdventSolution Solve(string input)
{
var lines = input.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var current = 50;
var password = 0;
foreach (var line in lines)
{
var direction = line[0] == 'L' ? -1 : 1;
var distance = int.Parse(line.Substring(1)) * direction;
current += distance;
current %= 100;
if(current == 0) password++;
}
return new AdventSolution(password.ToString(), null);
}
}