| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- 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}");
- }
- }
- }
|