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.

译文:

 
利用相同的方法寻找回文数。两个2位数字的乘积的最大回文是9009=91×99。

得到两个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的更多相关文章

  1. 【欧拉计划4】Largest palindrome product

    欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/1371281760.html 原创:[欧 ...

  2. 欧拉计划之Largest palindrome product

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...

  3. (Problem 4)Largest palindrome product

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...

  4. [LeetCode] Largest Palindrome Product 最大回文串乘积

    Find the largest palindrome made from the product of two n-digit numbers. Since the result could be ...

  5. 【easy】479. Largest Palindrome Product

    Find the largest palindrome made from the product of two n-digit numbers Since the result could be v ...

  6. [Swift]LeetCode479. 最大回文数乘积 | Largest Palindrome Product

    Find the largest palindrome made from the product of two n-digit numbers. Since the result could be ...

  7. Problem 4: Largest palindrome product

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...

  8. LeetCode Largest Palindrome Product

    原题链接在这里:https://leetcode.com/problems/largest-palindrome-product/description/ 题目: Find the largest p ...

  9. 【LeetCode】479. Largest Palindrome Product 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

随机推荐

  1. LNMP安装了哪些软件?安装目录在哪?

    LNMP官网:http://lnmp.org/faq/lnmp-software-list.html LNMP一键安装包除去安装所必须的依赖包,还会默认安装以下软件: Nginx.MySQL/Mari ...

  2. ORACLE 查看数据库中有哪些表

    SELECT TABLE_NAME FROM USER_TABLES ORDER BY TABLE_NAME;

  3. SQL Server 2005中的分区表(一):什么是分区表?为什么要用分区表?如何创建分区表?(转)

      如果你的数据库中某一个表中的数据满足以下几个条件,那么你就要考虑创建分区表了. 1.数据库中某个表中的数据很多.很多是什么概念?一万条?两万条?还是十万条.一百万条?这个,我觉得是仁者见仁.智者见 ...

  4. 查看maven项目的依赖关系 mvn dependency:tree

    maven-dependency-plugin最大的用途是帮助分析项目依赖,dependency:list能够列出项目最终解析到的依赖列表,dependency:tree能进一步的描绘项目依赖树,de ...

  5. I/B/P SP/SI

    H264中I.B.P帧 I帧:只作为参考帧,采用帧内预测 B帧:以其前面的I帧或P帧和后面的P帧作为参考帧 P帧:只能以前面的I帧或P帧作为参考帧 H264中的SP SI SP和SI是H264中引入的 ...

  6. Eclipse is running in a JRE, but a JDK is required 解决方法

    本文非原创,转自http://liguoliang.com/2010/eclipse-is-running-in-a-jre-but-a-jdk-is-required/ 安装Maven后每次启动出现 ...

  7. 洗清UI自动化鸡肋说的不白之冤

    人类文明发展的一个重要标识是工具的诞生,当人类开始制作工具来提高生产力时,就逐渐拉开了与其他生物的距离.曾在2013年,<Google如何测试软件>中提到的分层自动化金字塔,轰动业界.而在 ...

  8. SDUT 3347 数据结构实验之数组三:快速转置

    数据结构实验之数组三:快速转置 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 转置运算是一 ...

  9. MSP430F149学习之路——捕获/比较模式

    1.捕获模式 #include <msp430x14x.h> unsigned ,last1=; unsigned ,j=; void mian(void) { WDTCTL = WDTP ...

  10. rsync 参数断点续传

    断点续传是使用大写P参数,-P这个参数是综合了--partial --progress两个参数 rsync -avzP /home/hadoop/jdk1..0_73.tar.gz root@10.2 ...