コード例 #1
0
        static void Main(string[] args)
        {
            var    day1      = new day1();
            string day1Input = File.ReadAllText(@"input\day1.txt");

            Console.WriteLine("DAY1.1: Floor? {0}", day1.SolvePart1(day1Input));
            Console.WriteLine("DAY1.2: Position? {0}", day1.SolvePart2(day1Input));

            var    day2      = new day2();
            string day2Input = File.ReadAllText(@"input\day2.txt");

            Console.WriteLine("DAY2.1: Sqft of wrapping paper needed? {0}", day2.SolvePart1(day2Input));
            Console.WriteLine("DAY2.2: Ft of ribbon needed? {0}", day2.SolvePart2(day2Input));

            var    day3      = new day3();
            string day3Input = File.ReadAllText(@"input\day3.txt");

            Console.WriteLine("DAY3.1: Houses recieving at least one present? {0}", day3.SolvePart1(day3Input));
            Console.WriteLine("DAY3.2: Houses recieving at least one present with two santas? {0}", day3.SolvePart2(day3Input));

            var day4 = new day4();

            Console.WriteLine("DAY4.1: Lowest number with five leading zeros? {0}", day4.SolvePart1("yzbqklnj"));
            Console.WriteLine("DAY4.2: Lowest number with six leading zeros? {0}", day4.SolvePart2("yzbqklnj"));
        }
コード例 #2
0
ファイル: Day2Tests.cs プロジェクト: kfrancis/advent
        public void Day2_Part2_Example2()
        {
            // Arrange
            var problem = new day2();

            // Act
            int result = problem.SolvePart2("1x1x10");

            // Assert
            Assert.AreEqual(14, result);
        }
コード例 #3
0
ファイル: Day2Tests.cs プロジェクト: kfrancis/advent
        public void Day2_Part1_Example1()
        {
            // Arrange
            var problem = new day2();

            // Act
            int result = problem.SolvePart1("2x3x4");

            // Assert
            Assert.AreEqual(58, result);
        }
コード例 #4
0
ファイル: Day2Tests.cs プロジェクト: kfrancis/advent
        public void Day2_Part1_Example1()
        {
            // Arrange
            var problem = new day2();

            // Act
            int result = problem.SolvePart1("2x3x4");

            // Assert
            Assert.AreEqual(58, result);
        }
コード例 #5
0
ファイル: Day2Tests.cs プロジェクト: kfrancis/advent
        public void Day2_Part2_Example2()
        {
            // Arrange
            var problem = new day2();

            // Act
            int result = problem.SolvePart2("1x1x10");

            // Assert
            Assert.AreEqual(14, result);
        }
コード例 #6
0
        async Task stats(string txt)

        {
            Char del = '.';

            ((ArrayList)table.Resources["day228"]).Clear();

            string[] sub      = txt.Split(del);
            int      p1       = Int32.Parse(sub[0]);
            int      p2       = Int32.Parse(sub[1]);
            var      client   = new MongoClient(connectionString);
            var      database = client.GetDatabase("income");
            var      col      = database.GetCollection <Day>("Days");
            var      filter1  = Builders <Day> .Filter.Eq("month", p1);

            var filter2 = Builders <Day> .Filter.Eq("year", p2);

            var filterAnd = Builders <Day> .Filter.And(new List <FilterDefinition <Day> > {
                filter1, filter2
            });

            var b_days = await col.Find(filterAnd).ToListAsync();

            /* foreach (var day in b_days)
             * {
             *    day2 d = new day2 { dateTime2 = day.dateTime, unexp_income2 = day.unexp_income, unexp_expenses2 = day.unexp_expenses };
             *    ((ArrayList)table.Resources["day228"]).Add(d);
             *    table.Items.Add(d);
             *
             * }*/
            for (int i = 0; i < b_days.Count; i++)
            {
                day2[] d = new day2[b_days.Count];
                d[i]                 = new day2();
                d[i].dateTime2       = b_days[i].dateTime.ToShortDateString();
                d[i].unexp_income2   = b_days[i].unexp_income;
                d[i].unexp_expenses2 = b_days[i].unexp_expenses;
                ((ArrayList)table.Resources["day228"]).Add(d[i]);
                table.Items.Refresh();
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: kfrancis/advent
        static void Main(string[] args)
        {
            var day1 = new day1();
            string day1Input = File.ReadAllText(@"input\day1.txt");
            Console.WriteLine("DAY1.1: Floor? {0}", day1.SolvePart1(day1Input));
            Console.WriteLine("DAY1.2: Position? {0}", day1.SolvePart2(day1Input));

            var day2 = new day2();
            string day2Input = File.ReadAllText(@"input\day2.txt");
            Console.WriteLine("DAY2.1: Sqft of wrapping paper needed? {0}", day2.SolvePart1(day2Input));
            Console.WriteLine("DAY2.2: Ft of ribbon needed? {0}", day2.SolvePart2(day2Input));

            var day3 = new day3();
            string day3Input = File.ReadAllText(@"input\day3.txt");
            Console.WriteLine("DAY3.1: Houses recieving at least one present? {0}", day3.SolvePart1(day3Input));
            Console.WriteLine("DAY3.2: Houses recieving at least one present with two santas? {0}", day3.SolvePart2(day3Input));

            var day4 = new day4();
            Console.WriteLine("DAY4.1: Lowest number with five leading zeros? {0}", day4.SolvePart1("yzbqklnj"));
            Console.WriteLine("DAY4.2: Lowest number with six leading zeros? {0}", day4.SolvePart2("yzbqklnj"));
        }