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位数字的乘积的最大回文。
import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { List<Integer> list = new ArrayList<Integer>(); int a=0; for(int i=99;i<1000;i++) { for(int j=99;j<1000;j++) { list.add(j*i); } } List<Integer> lis = new ArrayList<Integer>(); for(int i=0;i<list.size();i++) { if(list.get(i)>100000) { if(list.get(i) % 10 ==list.get(i) / 100000 && (list.get(i) /10)% 10 ==(list.get(i) / 10000)%10 && (list.get(i) / 1000)%10 ==(list.get(i) / 100)%10) { lis.add(list.get(i)); } } } int max=lis.get(0); for(int i=0;i<lis.size();i++) { if(max<lis.get(i)) { max=lis.get(i); } } System.out.println(max); } }
结果:
906609
Largest palindrome product的更多相关文章
- 【欧拉计划4】Largest palindrome product
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/1371281760.html 原创:[欧 ...
- 欧拉计划之Largest palindrome product
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...
- (Problem 4)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 ...
- Problem 4: 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
原题链接在这里: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 ...
随机推荐
- eclipse中debug
在需要测试的代码行左侧行号列上双击,生成断点 ,再次双击可以取消断点 如图: 然后右键,选择Debug As-Java Application,(注意,不是选择Run As) 开始调试java ...
- 收缩sql server2008 数据库
USE DATABASENAME; GO -- Truncate the log by changing the database recovery model to SIMPLE. ALTER DA ...
- XXX项目 android 开发笔记
1 工具? eclipse or android studio fragment 套用
- Regex 例
密码复杂度:数字英文符号Regex r = new Regex("^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[a-z])(? ...
- Ext vtype
//form验证中vtype的默认支持类型1.alpha //只能输入字母,无法输入其他(如数字,特殊符号等)2.alphanum//只能输入字母和数字,无法输入其他3.email//email验证, ...
- window上Python环境的搭建
python下载地址:https://www.python.org/ 下载安装 安装完成后配置环境变量,在我的电脑右键属性点高级设置 双击 环境变量 里面第二框找到 path双击 在pytho ...
- java边界布局管理器
public class BorderLayoutPosition extends JFrame{ String[] border={BorderLayout.CENTER,Border ...
- Sqoop增量从MySQL中向hive导入数据
sqoop job --create incretest -- import --connect jdbc:mysql://10.8.2.19:3306/db --table table1 --use ...
- "HTTP 错误 500.19 请求的页面的相关配置数据无效" 解决办法
HTTP 错误 500.19 - Internal Server Error无法访问请求的页面,因为该页的相关配置数据无效. 问题"详细错误信息模块 IIS Web Core通知 Begin ...
- com学习(四)2——用 ATL 写第一个组件(vs2003)
步骤2.1:建立一个解决方案. 步骤2.2:在 该解决方案中,新建一个 vc++ 的 ATL 项目.示例程序叫 Simple2,并选择DLL方式,见图一.图二. 图一.新建 ATL 项目 图二.选择非 ...