| 123456789101112131415161718192021222324252627282930313233 |
- using System;
- using System.IO;
- using System.Linq;
- namespace D02._1
- {
- class Program
- {
- static void Main(string[] args)
- {
- if (args.Length < 1) return;
- if (File.Exists(args[0]) == false) throw new FileNotFoundException();
- int sq = 0;
- using (var file = File.OpenText(args[0]))
- {
- while (true)
- {
- var line = file.ReadLine();
- if (line == null) break;
- var dim = line.Split("x").Select(s => int.Parse(s)).ToArray();
- int l = dim[0], w = dim[1], h = dim[2];
- int side1 = l * w, side2 = w * h, side3 = h * l;
- sq += 2 * side1 + 2 * side2 + 2 * side3 + Math.Min(side1, Math.Min(side2, side3));
- }
- }
- Console.WriteLine($"Answer is : {sq}");
- }
- }
- }
|