From 3bd5e13f0ce42ab1672dbdf4017c85fe1ad0c4db Mon Sep 17 00:00:00 2001 From: Benjamin Kyd Date: Tue, 1 Dec 2020 15:13:58 +0000 Subject: [PATCH] 2020 --- .vscode/settings.json | 14 +- ...CoreApp,Version=v2.1.AssemblyAttributes.cs | 4 + .../netcoreapp2.1/challenge1.AssemblyInfo.cs | 23 ++ .../challenge1.AssemblyInfoInputs.cache | 1 + ...CoreApp,Version=v2.1.AssemblyAttributes.cs | 4 + .../netcoreapp2.1/challenge2.AssemblyInfo.cs | 23 ++ .../challenge2.AssemblyInfoInputs.cache | 1 + 2020/1.cpp | 57 +++++ 2020/1.txt | 200 ++++++++++++++++++ 9 files changed, 326 insertions(+), 1 deletion(-) create mode 100644 2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs create mode 100644 2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfo.cs create mode 100644 2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfoInputs.cache create mode 100644 2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs create mode 100644 2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfo.cs create mode 100644 2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfoInputs.cache create mode 100644 2020/1.cpp create mode 100644 2020/1.txt diff --git a/.vscode/settings.json b/.vscode/settings.json index d002ed5..070c565 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -40,6 +40,18 @@ "xstring": "cpp", "xtr1common": "cpp", "xutility": "cpp", - "algorithm": "cpp" + "algorithm": "cpp", + "concepts": "cpp", + "ctime": "cpp", + "iomanip": "cpp", + "iterator": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "xhash": "cpp", + "xlocmon": "cpp", + "xloctime": "cpp", + "xtree": "cpp" } } \ No newline at end of file diff --git a/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs b/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs new file mode 100644 index 0000000..c47ed2d --- /dev/null +++ b/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v2.1", FrameworkDisplayName = "")] diff --git a/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfo.cs b/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfo.cs new file mode 100644 index 0000000..2127774 --- /dev/null +++ b/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("challenge1")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("challenge1")] +[assembly: System.Reflection.AssemblyTitleAttribute("challenge1")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfoInputs.cache b/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfoInputs.cache new file mode 100644 index 0000000..5a40878 --- /dev/null +++ b/2018/3rdDay/challenge1/obj/Debug/netcoreapp2.1/challenge1.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +4e41332ddf7d58c9b78f731c8689aa24d4aa5c68 diff --git a/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs b/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs new file mode 100644 index 0000000..c47ed2d --- /dev/null +++ b/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v2.1", FrameworkDisplayName = "")] diff --git a/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfo.cs b/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfo.cs new file mode 100644 index 0000000..4c0f79b --- /dev/null +++ b/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("challenge2")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("challenge2")] +[assembly: System.Reflection.AssemblyTitleAttribute("challenge2")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfoInputs.cache b/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfoInputs.cache new file mode 100644 index 0000000..09e273d --- /dev/null +++ b/2018/3rdDay/challenge2/obj/Debug/netcoreapp2.1/challenge2.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +d23734efb6c85f77056301d19eda620d53b5abad diff --git a/2020/1.cpp b/2020/1.cpp new file mode 100644 index 0000000..a27e1a2 --- /dev/null +++ b/2020/1.cpp @@ -0,0 +1,57 @@ +#include +#include +#include +#include + +int main() +{ + std::ifstream file ("./1i.txt"); + std::vector input; + std::string line; + + while(std::getline(file, line)) + { + input.push_back(std::stoi(line)); + } + + int found = 0; + + for (auto& i : input) + { + for (auto j : input) + { + if (i + j == 2020) + { + found = i * j; + break; + } + } + if (found != 0) + break; + } + + std::cout << "Part 1, 2 entries that sum to 2020: " << found << std::endl; + found = 0; + + for (auto& i : input) + { + for (auto j : input) + { + for (auto k : input) + { + if (i + j + k == 2020) + { + found = i * j * k; + break; + } + } + if (found != 0) + break; + } + if (found != 0) + break; + } + + std::cout << "Part 2, 3 entries that sum to 2020: " << found << std::endl; + +} diff --git a/2020/1.txt b/2020/1.txt new file mode 100644 index 0000000..3e96826 --- /dev/null +++ b/2020/1.txt @@ -0,0 +1,200 @@ +1036 +1897 +1256 +1080 +1909 +1817 +1759 +1883 +1088 +1841 +1780 +1907 +1874 +1831 +1932 +1999 +1989 +1840 +1973 +1102 +1906 +1277 +1089 +1275 +1228 +1917 +1075 +1060 +1964 +1942 +2001 +1950 +1181 +1121 +1854 +1083 +1772 +1481 +1976 +1805 +1594 +1889 +1726 +1866 +798 +1739 +1709 +1946 +1948 +1808 +1836 +1849 +1465 +1066 +1943 +664 +1894 +1993 +1061 +1225 +1589 +1916 +1885 +1998 +1470 +1668 +1666 +1499 +1437 +1986 +1127 +1875 +1132 +1888 +1877 +1046 +1982 +1265 +1757 +1848 +1786 +1638 +1958 +1015 +1013 +1552 +1742 +1850 +1016 +1839 +558 +1826 +1261 +1988 +1545 +1078 +1963 +1967 +1951 +1086 +1947 +1880 +1903 +1994 +1167 +1736 +1041 +1652 +1040 +1033 +1179 +1844 +1861 +1488 +1962 +1135 +1347 +1187 +1777 +1598 +1803 +1147 +1760 +1926 +1898 +1923 +1865 +1313 +1924 +1023 +1576 +1715 +1391 +1346 +1882 +2000 +1024 +1143 +1065 +1560 +1029 +1119 +1966 +1022 +1931 +1512 +1049 +1929 +1312 +1069 +1159 +1053 +1249 +1074 +1983 +1761 +1868 +195 +24 +1331 +1636 +1020 +1034 +1671 +708 +1699 +1900 +1927 +1829 +301 +1832 +1042 +1896 +1928 +1032 +1992 +2005 +1955 +1047 +1068 +1001 +1052 +1744 +1845 +1208 +1018 +1859 +1342 +1823 +1758 +2007 +1241 +1893 +1876 +1984 +1655 +1534 +1150 +1789 +1870 \ No newline at end of file