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 ...
随机推荐
- 如何实现多个div水平均匀排列且量两端贴壁
下面先看一段代码实例: <!DOCTYPE html><html><head><meta charset=" utf-8">< ...
- 解决Xshell和vim中文乱码(转载)
From:http://blog.csdn.net/lovey599/article/details/7275403 一般而言,乱码多是由于编码问题引起 的,在windows系统中,大多数情况下中文编 ...
- Protobuf从安装到配置整理帖
新做的Mini项目计划使用Google的Protobuf来做,关于Protobuf是什么玩意能干什么请自己去看这里:http://code.google.com/p/protobuf/ 这里讲一下安装 ...
- RPM软件包制作
参考网站:How to create an RPM package/zh-cn[教程]https://fedoraproject.org/wiki/How_to_create_an_RPM_packa ...
- dedeCMS安装,前端样式不显示
因为dedeCMS样式引用用的是绝对路径:dede默认安装在网站的根目录. 所以,解决方法有三种: 1.修改代码路径,很不推荐,那么多页面可操作性低: 2.直接安装在站点根目录www目录,也行,但是容 ...
- struts2 使用注解方式配置
1.导入convention 包 2.java: package com.struts.base.hello; import java.io.IOException; import java.io.P ...
- 问答精华-IntelliJ IDEA快捷键大全
这篇文章介绍了idea的默认快捷键http://www.jikexueyuan.com/blog/229.html 另外:老师将快捷键设置为eclipse的了,你需要在preference里面找到ke ...
- [SQL]patindex的用法
返回指定表达式中某模式第一次出现的起始位置:如果在全部有效的文本和字符数据类型中没有找到该模式,则返回零. Transact-SQL 语法约定 语法 PATINDEX ( '%pattern%' , ...
- POJ 2112 Optimal Milking 【网络流】【二分】【最短路】
题意: k c m 分别代表挤奶机数量,牛数量,和挤奶机容量. 接下来(n=k+c)n*n的矩阵A,代表挤奶机或者牛的距离,如果对角线都为0,如果非对角线没有直接路相连也为0. 1 <= K & ...
- mysql 基本使用教程(源于网络)
http://dev.mysql.com/doc/refman/5.1/zh/index.html 3.1. 连接与断开服务器 3.2. 输入查询 3.3. 创建并使用数据库 3.3.1. 创建并选择 ...