Created
August 9, 2016 06:50
-
-
Save gulbanana/d21147356461125aba8db2724b683808 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
class Euler | |
{ | |
static void Main(string[] args) => Console.WriteLine( | |
File.ReadAllText("./p022_names.txt") | |
.Replace("\"", "") | |
.Split(',') | |
.OrderBy(n => n) | |
.Select((n, i) => n.Select(c => (int)c - 64).Sum() * (i+1)) | |
.Sum() | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment