bastien.monsarrat 6 жил өмнө
parent
commit
7648ae66dc

+ 6 - 0
Adv2015.sln

@@ -87,6 +87,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D23", "D23.1\D23.csproj", "
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D24", "D24.1\D24.csproj", "{7E1EFA57-3A85-44B1-9FE1-9D5D83AD1160}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "D25.1", "D25.1\D25.1.csproj", "{84CAC70B-391A-49A1-91B5-6DA9E70C64F7}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -261,6 +263,10 @@ Global
 		{7E1EFA57-3A85-44B1-9FE1-9D5D83AD1160}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{7E1EFA57-3A85-44B1-9FE1-9D5D83AD1160}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{7E1EFA57-3A85-44B1-9FE1-9D5D83AD1160}.Release|Any CPU.Build.0 = Release|Any CPU
+		{84CAC70B-391A-49A1-91B5-6DA9E70C64F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{84CAC70B-391A-49A1-91B5-6DA9E70C64F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{84CAC70B-391A-49A1-91B5-6DA9E70C64F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{84CAC70B-391A-49A1-91B5-6DA9E70C64F7}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 9 - 0
D25.1/D25.1.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+    <RootNamespace>D25._1</RootNamespace>
+  </PropertyGroup>
+
+</Project>

+ 44 - 0
D25.1/Program.cs

@@ -0,0 +1,44 @@
+using System;
+using System.IO;
+using System.Text.RegularExpressions;
+
+namespace D25._1
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            if (args.Length < 1) throw new ArgumentException();
+            if (File.Exists(args[0]) == false) throw new FileNotFoundException();
+
+            int row = 1, col = 1;
+            ulong n = 20151125;
+
+            var regex = new Regex(@"row (?<r>\d+), column (?<c>\d+)");
+            string input = File.ReadAllText(args[0]);
+            var result = regex.Match(input);
+
+            var breakRow = int.Parse(result.Groups["r"].Value);
+            var breakColumn = int.Parse(result.Groups["c"].Value);
+
+            while (true)
+            {
+                row--;
+                col++;
+
+                if (row == 0)
+                {
+                    row = col;
+                    col = 1;
+                }
+
+                n = (n * 252533) % 33554393;
+
+                if (row == breakRow && col == breakColumn)
+                    break;
+            }
+
+            Console.WriteLine($"Answer is : {n}");
+        }
+    }
+}

+ 8 - 0
D25.1/Properties/launchSettings.json

@@ -0,0 +1,8 @@
+{
+  "profiles": {
+    "D25.1": {
+      "commandName": "Project",
+      "commandLineArgs": "\"..\\..\\..\\..\\D25.1\\input.txt\""
+    }
+  }
+}

+ 1 - 0
D25.1/input.txt

@@ -0,0 +1 @@
+To continue, please consult the code grid in the manual.  Enter the code at row 2947, column 3029.