| 1234567891011121314151617181920212223242526272829303132 |
- using System;
- using System.IO;
- using System.Linq;
- namespace D03._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 answer = 0;
- using (var file = File.OpenText(args[0]))
- {
- while (true)
- {
- var line = file.ReadLine();
- if (line == null) break;
- int[] l = line.Split(' ', StringSplitOptions.RemoveEmptyEntries).Select(s => int.Parse(s)).ToArray();
- answer += l[0] + l[1] > l[2] && l[0] + l[2] > l[1] && l[1] + l[2] > l[0] ? 1 : 0;
- }
- }
- Console.WriteLine($"The answer is : {answer}");
- }
- }
- }
|