Problem 4: Largest palindrome product
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.
3位数的话,就从999开始,为了减少遍历次数,就先从999-900,如果没有条件满足,再放大这个范围
l = []
for i in range(999, 900, -1):
for j in range(999, 900, -1):
n = str(i * j)
if n == n[::-1]:
l.append(int(n))
print(max(l))
执行结果:906609
Problem 4: Largest palindrome product的更多相关文章
- 【欧拉计划4】Largest palindrome product
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/1371281760.html 原创:[欧 ...
- (Problem 4)Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...
- Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...
- 欧拉计划之Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...
- [LeetCode] Largest Palindrome Product 最大回文串乘积
Find the largest palindrome made from the product of two n-digit numbers. Since the result could be ...
- 【easy】479. Largest Palindrome Product
Find the largest palindrome made from the product of two n-digit numbers Since the result could be v ...
- [Swift]LeetCode479. 最大回文数乘积 | Largest Palindrome Product
Find the largest palindrome made from the product of two n-digit numbers. Since the result could be ...
- LeetCode Largest Palindrome Product
原题链接在这里:https://leetcode.com/problems/largest-palindrome-product/description/ 题目: Find the largest p ...
- 【LeetCode】479. Largest Palindrome Product 解题报告(Python & C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...
随机推荐
- JavaScript 随意记
js 志异: <script> // ----- 1 --------- alert(new Date()) alert(+new Date()) </script>
- 区块链 编译android geth 填坑记录 ubuntu
下载geth 源码 直接 make android 下载android ndk sdk 配置环境变量cd 安装golang 设置环境变量 发现没有gomobile命令 按照wiki方法 执行安装g ...
- T57274 黑暗城堡
传送门 思路: 先求出各个点到 1 的最短路径.分别用两个数组将最短路径记录下来(一个要用来排序).按排序后的 dis 值从小到大枚举各点加入树有多少种方案,最后根据乘法原理把各个点的方案数乘起来就是 ...
- julia 安装
https://julialang.org/downloads/ 下载安装程序,拖拽完成安装
- 修改Ubuntu锁屏快捷键
修改为Win + L. 避免与Phpstorm中的代码格式化冲突.
- 环境准备—之—linux下安装svn--开机自启--及format权限问题
借鉴自 http://www.cnblogs.com/liuxianan/p/linux_install_svn_server.html 这个很详细,但不是我的风格 https://blog.csdn ...
- 修改 jenkins 主目录
说明 Jenkins有时需要进行迁移,主目录会发生改变,本文主要讲解如何更改主目录.由于jenkins安装方式的不同,主目录也不一样.本测试环境:Centos6.8 X64.注意:在更改主目录之前,请 ...
- Robot Framework自动化测试(1)
Python: https://www.python.org/ RF框架是基于python 的,所以一定要有python环境. Robot framework : https://pypi.pytho ...
- 『高性能模型』轻量级网络MobileNet_v2
论文地址:MobileNetV2: Inverted Residuals and Linear Bottlenecks 前文链接:『高性能模型』深度可分离卷积和MobileNet_v1 一.Mobil ...
- XJ模拟noip赛1
什么都不说—— 成功打出 G-G!