projecteuler---->problem=8----Largest product in a series
title:
The four adjacent digits in the 1000-digit number that have the greatest product are 9
9
8
9 = 5832.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450
Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
翻译:
求出连续的13位数的积,使其最大
a="73167176531330624919225119674426574742355349194934"
a1="96983520312774506326239578318016984801869478851843"
a2="85861560789112949495459501737958331952853208805511"
a3="12540698747158523863050715693290963295227443043557"
a4="66896648950445244523161731856403098711121722383113"
a5="62229893423380308135336276614282806444486645238749"
a6="30358907296290491560440772390713810515859307960866"
a7="70172427121883998797908792274921901699720888093776"
a8="65727333001053367881220235421809751254540594752243"
a9="52584907711670556013604839586446706324415722155397"
a10="53697817977846174064955149290862569321978468622482"
a11="83972241375657056057490261407972968652414535100474"
a12="82166370484403199890008895243450658541227588666881"
a13="16427171479924442928230863465674813919123162824586"
a14="17866458359124566529476545682848912883142607690042"
a15="24219022671055626321111109370544217506941658960408"
a16="07198403850962455444362981230987879927244284909188"
a17="84580156166097919133875499200524063689912560717606"
a18="05886116467109405077541002256983155200055935729725"
a19="71636269561882670428252483600823257530420752963450"
a=a+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19
resu=0
for i in range(0,987):
s=1
for j in range(13):
s*=int(a[i+j])
if s > resu:
resu = s
print resu
projecteuler---->problem=8----Largest product in a series的更多相关文章
- projecteuler Problem 8 Largest product in a series
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = ...
- Problem 8: Largest product in a series
先粘实现代码,以后需要再慢慢补充思路 s = ''' 73167176531330624919225119674426574742355349194934 9698352031277450632623 ...
- Largest product in a series
这个我开始理解错了,算错了. 我以为是求连续5个数的最大值,结果,是连接5个数相乘的最大值. 英语不好,容易吃亏啊. Find the greatest product of five consecu ...
- 【Project Euler 8】Largest product in a series
题目要求是: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × ...
- Project Euler 8 Largest product in a series
题意:寻找这 1000 个数中相邻 13 个数相乘积最大的值 思路:首先想到的是暴力,但是还可以利用之前记录过的数值,什么意思呢?即在计算 2 - 14 后,再计算 3 - 15 时完全可以利用之前计 ...
- Largest product from 3 integers
https://github.com/Premiumlab/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Moc ...
- Problem 4: Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...
- R语言学习——欧拉计划(11)Largest product in a grid
Problem 11 In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 0 ...
- Largest product in a grid
这个比前面的要复杂点,但找对了规律,还是可以的. 我逻辑思维不强,只好画图来数数列的下标了. 分四次计算,存入最大值. 左右一次,上下一次,左斜一次,右斜一次. In the 2020 grid be ...
随机推荐
- Expression Language
EL找不到属性会返回"" page –- request --- session --- application ------------------------------- ...
- Mysql数据库中的EXISTS和NOT EXISTS
SQL语言中没有蕴含逻辑运算.但是,可以利用谓词演算将一个逻辑蕴含的谓词等价转换为:p->q ≡┐p∨q. 我们通过一个具体的题目来分析:(具体的表和数据详见文章:Mysql数据库中的EXIST ...
- css样式写一个三角形
<style> .test{ border-color:transparent #abcdef transparent transparent; border-style:solid; b ...
- Linux 网络编程基础(2)-- 获取主机信息
前一篇已经介绍了最基本的网络数据结构.这篇介绍一下获取主机信息的函数 举个例子,想要通过代码的方式从百度获取当前的时间,怎么做?我们不知道百度的IP地址啊,这代码怎么写?还好,Linux提供了一些AP ...
- nyoj 138 找球号(二)(哈希)
题目:nyoj——138 /*** 哈希求解...采用链表保存 插入时,可以去除重复 查找 找到该组,然后在改组的查找 当这个组不存在时或是没有找到时是 NO 其他是YES 1e6+1 时间最短 */ ...
- Spring Boot的一个测试用例
package tk.mybatis.springboot.mapper; import org.junit.Assert; import org.junit.Test; import org.jun ...
- Swagger+Spring MVC框架学习分享
[html] view plain copy 最近参与公司接口编写,Android和IOS端都要调用这些接口,需要对接调试,如果没有一个接口文档,管理接口,别人用了接口,也不知道接口怎么用,接口上有什 ...
- hibernate-search-5.1.1简易使用
系统要求java7和hibernate-core-4.3.8,此外还依赖如下jar包 使用demo如下: package com.ciaos.controller; import java.io.IO ...
- 那些年我们写过的三重循环----CodeForces 295B Greg and Graph 重温Floyd算法
Greg and Graph time limit per test 3 seconds memory limit per test 256 megabytes input standard inpu ...
- C++学习笔记6
泛型算法 1. 算法怎样工作 每一个泛型算法的实现都独立于单独的容器.这些算法还是大而不全的,而且不依赖于容器存储的元素类型.为了知道算法怎样工作,让我们深入了解find 操作.该操作的任务是在一个未 ...