Last active
August 29, 2015 14:04
-
-
Save bencoveney/038a67cee71bcf24d28e to your computer and use it in GitHub Desktop.
Large Sum
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Numerics; | |
using System.Threading.Tasks; | |
namespace EulerProject | |
{ | |
class Program | |
{ | |
// Constant Values | |
private const int numChars = 50; | |
[STAThread] | |
static void Main(string[] args) | |
{ | |
cheat(); | |
} | |
public static void cheat() | |
{ | |
// Open a stream from the file | |
StreamReader streamReader = new StreamReader("TextFile1.txt"); | |
// Read the lines from the file into char arrays | |
List<BigInteger> numberStrings = new List<BigInteger>(); | |
string line; | |
while ((line = streamReader.ReadLine()) != null) | |
{ | |
numberStrings.Add(BigInteger.Parse(line)); | |
} | |
BigInteger result = new BigInteger(); | |
numberStrings.ForEach(x => result += x); | |
System.Windows.Forms.Clipboard.SetText(result.ToString().Substring(0, 10)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment