| 123456789101112131415161718192021222324252627282930313233 |
- using System;
- using System.IO;
- using System.Linq;
- namespace D02._2
- {
- class Program
- {
- static void Main(string[] args)
- {
- if (args.Length < 1) return;
- if (File.Exists(args[0]) == false) throw new FileNotFoundException();
- int ft = 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 peri1 = 2 * l + 2 * w, peri2 = 2 * w + 2 * h, peri3 = 2 * h + 2 * l;
- ft += Math.Min(peri1, Math.Min(peri2, peri3)) + l * h * w;
- }
- }
- Console.WriteLine($"Answer is : {ft}");
- }
- }
- }
|