Advertisement
Deerenaros

Untitled

Oct 28th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Diagnostics;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace ConsoleApplication1 {
  10.     class Program {
  11.         static void Main (string[] args) {
  12.             int result = Directory.GetFiles( args[0] ).AsParallel().Select( (filename) => {
  13.                 return File.ReadLines(filename).Select(int.Parse).Sum();
  14.             } ).Sum();
  15.            
  16.             Console.WriteLine( result );
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement