Day 06, Part 2, better naming scheme

This commit is contained in:
Jeremy Kescher 2023-12-15 18:30:30 +01:00
parent 0c3c2ce6a3
commit dbe6de1b97
Signed by: Jeremy Kescher
GPG key ID: 80A419A7A613DFA4
26 changed files with 54 additions and 15 deletions

View file

@ -1,6 +1,6 @@
using System.Diagnostics.Contracts;
namespace DayThree.PartOne;
namespace Day03.Part1;
public static class CharExtensions
{

View file

@ -1,6 +1,6 @@
using System.Buffers;
namespace DayThree.PartOne;
namespace Day03.Part1;
internal static class Program
{

View file

@ -1,4 +1,4 @@
namespace DayThree.PartTwo;
namespace Day03.Part2;
internal static class Program
{

View file

@ -1,4 +1,4 @@
namespace DayFive.PartOne;
namespace Day05.Part1;
internal static class Program
{

View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,23 @@
using System.Text;
var timeLine = Console.ReadLine().AsSpan(10);
var distanceLine = Console.ReadLine().AsSpan(10);
var stringBuilder = new StringBuilder();
foreach (var c in timeLine)
if (c != ' ')
stringBuilder.Append(c);
var time = long.Parse(stringBuilder.ToString());
stringBuilder.Clear();
foreach (var c in distanceLine)
if (c != ' ')
stringBuilder.Append(c);
var recordDistance = long.Parse(stringBuilder.ToString());
for (var i = recordDistance / time; i <= time; i++)
if ((time - i) * i > recordDistance)
{
Console.WriteLine(time - i * 2 + 1);
break;
}

View file

@ -1,26 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayOne.PartOne", "DayOne\DayOne.PartOne\DayOne.PartOne.csproj", "{DA89E51D-0DF1-48E9-8DDF-2F91346F95BF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day01.Part1", "Day01\Day01.Part1\Day01.Part1.csproj", "{DA89E51D-0DF1-48E9-8DDF-2F91346F95BF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayOne.PartTwo", "DayOne\DayOne.PartTwo\DayOne.PartTwo.csproj", "{3238E5B9-31C1-470E-B76D-BC7EF23684F2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day01.Part2", "Day01\Day01.Part2\Day01.Part2.csproj", "{3238E5B9-31C1-470E-B76D-BC7EF23684F2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayTwo.PartOne", "DayTwo\DayTwo.PartOne\DayTwo.PartOne.csproj", "{1D26E266-3562-437E-95C0-ECD34FBDC902}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day02.Part1", "Day02\Day02.Part1\Day02.Part1.csproj", "{1D26E266-3562-437E-95C0-ECD34FBDC902}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayTwo.PartTwo", "DayTwo\DayTwo.PartTwo\DayTwo.PartTwo.csproj", "{DB784639-4DBF-4502-BBAE-EB6929919114}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day02.Part2", "Day02\Day02.Part2\Day02.Part2.csproj", "{DB784639-4DBF-4502-BBAE-EB6929919114}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayThree.PartOne", "DayThree\DayThree.PartOne\DayThree.PartOne.csproj", "{0041723B-BA8D-47F2-8CAC-78B3E526F90D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day03.Part1", "Day03\Day03.Part1\Day03.Part1.csproj", "{0041723B-BA8D-47F2-8CAC-78B3E526F90D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayThree.PartTwo", "DayThree\DayThree.PartTwo\DayThree.PartTwo.csproj", "{53C25CED-FB27-4379-9986-AC4F6E58D9CC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day03.Part2", "Day03\Day03.Part2\Day03.Part2.csproj", "{53C25CED-FB27-4379-9986-AC4F6E58D9CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayFour.PartOne", "DayFour\DayFour.PartOne\DayFour.PartOne.csproj", "{A69765B0-4BF4-4593-A796-97165A8B7243}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day04.Part1", "Day04\Day04.Part1\Day04.Part1.csproj", "{A69765B0-4BF4-4593-A796-97165A8B7243}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayFour.PartTwo", "DayFour\DayFour.PartTwo\DayFour.PartTwo.csproj", "{E2E1EACE-BDD4-4D6D-82EC-28C8002CB2D9}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day04.Part2", "Day04\Day04.Part2\Day04.Part2.csproj", "{E2E1EACE-BDD4-4D6D-82EC-28C8002CB2D9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayFive.PartOne", "DayFive\DayFive.PartOne\DayFive.PartOne.csproj", "{76808E18-BBFC-40E5-933F-D1D792FD6741}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day05.Part1", "Day05\Day05.Part1\Day05.Part1.csproj", "{76808E18-BBFC-40E5-933F-D1D792FD6741}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayFive.PartTwo", "DayFive\DayFive.PartTwo\DayFive.PartTwo.csproj", "{84282D8D-4011-40BD-9672-B504EB557529}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day05.Part2", "Day05\Day05.Part2\Day05.Part2.csproj", "{84282D8D-4011-40BD-9672-B504EB557529}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaySix.PartOne", "DaySix\DaySix.PartOne\DaySix.PartOne.csproj", "{389052F4-0ED5-4D4E-A35F-08170093CE5A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day06.Part1", "Day06\Day06.Part1\Day06.Part1.csproj", "{389052F4-0ED5-4D4E-A35F-08170093CE5A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Day06.Part2", "Day06\Day06.Part2\Day06.Part2.csproj", "{795AD39A-63A3-4A3B-9D58-267BCD7E5AAA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -72,5 +74,9 @@ Global
{389052F4-0ED5-4D4E-A35F-08170093CE5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{389052F4-0ED5-4D4E-A35F-08170093CE5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{389052F4-0ED5-4D4E-A35F-08170093CE5A}.Release|Any CPU.Build.0 = Release|Any CPU
{795AD39A-63A3-4A3B-9D58-267BCD7E5AAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{795AD39A-63A3-4A3B-9D58-267BCD7E5AAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{795AD39A-63A3-4A3B-9D58-267BCD7E5AAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{795AD39A-63A3-4A3B-9D58-267BCD7E5AAA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal