zl程序教程

您现在的位置是:首页 >  其它

当前栏目

欧拉计划之Largest palindrome product

计划 product 欧拉 Palindrome Largest
2023-09-27 14:28:45 时间
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.

def depart(n):

 DList = []

 while n = 10 :

 DList.append(n % 10)

 n = n/10

 DList.append(n)

 return DList

maxmulti = 10000

for i in xrange(100,1000):

 for j in xrange(100,1000):

 multi = i * j

 MList = depart(multi)

 RList = MList[:]

 RList.reverse()

 if RList == MList:

 if multi maxmulti:

 maxmulti = multi

 print {0} * {1}.format(i,j)

print maxmulti

。。。。。

722 * 968
759 * 953
803 * 909
803 * 959
831 * 968
844 * 957
858 * 966
869 * 982
894 * 957
913 * 993
906609


LeetCode 39. Combination Sum 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的数字可以无限制重复被选取。
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in the
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimit