예제 #1
0
        protected override long GetCalculationResult()
        {
            _longNums = _numbers.Select(n => new LongNum(n)).ToList();
            //var s = _longNums[0].Add(_longNums[1]).Add(_longNums[2]);
            //Print("{0,55}", _longNums[0]);
            //Print("{0,55}", _longNums[1]);
            //Print("{0,55}", _longNums[2]);
            //Print("{0,55}", s);

            //var nine = new LongNum("9");
            //var s = nine.Add(nine).Add(nine).Add(nine);
            //Print("{0,55}", s);
            //return 0;

            var result = new LongNum("0");

            _longNums.ForEach(n => result = result.Add(n));
            _longNums.ForEach(n => Print("{0,55}", n));
            Print("{0,55}", result);

            var r = long.Parse(result.ToString().Substring(0, 10));

            return(r);
        }
예제 #2
0
파일: LongNum.cs 프로젝트: jhogstrom/euler
 public LongNum(LongNum num)
     : this(num.ToString())
 {
 }
예제 #3
0
 public LongNum(LongNum num) : this(num.ToString())
 {
 }