# Project Euler Problem 08 C# Solution

using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjectEuler01
{
class Program
{

static void Main(string[] args)
{
Stopwatch watch = new Stopwatch();
watch.Start();

const String p = @"73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661428280644448664523874930358907296290491560440772390713810515859307960866701724271218839987979087922749219016997208880937766572733300105336788122023542180975125454059475224352584907711670556013604839586446706324415722155397536978179778461740649551492908625693219784686224828397224137565705605749026140797296865241453510047482166370484403199890008895243450658541227588666881164271714799244429282308634656748139191231628245861786645835912456652947654568284891288314260769004207198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450";

int num_length = 13;
long largest = 0;

List<long> mynum = new List<long>();

for (int i = 0; i < p.Length-num_length; i++)
{
long numm = 1;
mynum.Clear();
numm = p[i]-'0';

for (int j = 1; j < num_length; j++)
{
numm *= (p[i+j]-'0');
}
if (numm>largest)
{
largest = numm;
mynum.ForEach(Console.WriteLine);
Console.WriteLine("=========================");
}

}
Console.WriteLine(largest);

watch.Stop();
double ts = watch.Elapsed.TotalMilliseconds;
Console.WriteLine("Totoal running time is " + ts + " ms ");
}

}
}

• 本文已收录于以下专栏：

## project euler problem 5

• 2010-12-18 10:58
• 18KB
• 下载

## Project Euler：Problem 49 Prime permutations

The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...

## Project Euler：Problem 22 Names scores

Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-t...

## Project Euler Problem 32 Pandigital products

Pandigital products Problem 32 We shall say that an n-digit number is pandigital if it makes use ...

## Project Euler：Problem 51 Prime digit replacements

By replacing the 1st digit of the 2-digit number *3, it turns out that six of the nine possible valu...

## Project Euler：Problem 86 Cuboid route

A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the o...

## Project Euler：Problem 18 Maximum path sum I

By starting at the top of the triangle below and moving to adjacent numbers on the row below, the ma...

## Project Euler - Problem 5

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any rema...

## Project Euler：Problem 50 Consecutive prime sum

The prime 41, can be written as the sum of six consecutive primes: 41 = 2 + 3 + 5 + 7 + 11 + 13 ...

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)