Created
July 5, 2013 09:10
-
-
Save AlexArchive/5933161 to your computer and use it in GitHub Desktop.
Project Euler: Problem 22
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
private static IEnumerable<string> LoadNames() | |
{ | |
string names =File.ReadAllText("names.txt"); | |
return names.Split(',') | |
.Select(name => name.Substring(1, name.Length - 2)); | |
} | |
private static int CalculateTotalScore() | |
{ | |
return LoadName().OrderBy(x => x) | |
.Select((name, index) => (++index) * name.Sub(c => (int) c - 64)) | |
.Sum(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment