| 12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using System.IO;
- using System.Text.RegularExpressions;
- namespace D08._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 incode = 0, inmemory = 0;
- using (var file = File.OpenText(args[0]))
- {
- while (true)
- {
- var line = file.ReadLine();
- if (line == null) break;
- var nstring = Regex.Unescape(line.Substring(1, line.Length - 2));
- incode += line.Length;
- inmemory += nstring.Length;
- }
- }
- int answer = incode - inmemory;
- Console.WriteLine($"The answer is : {answer}");
- }
- }
- }
|