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. JS 中的 Window 对象

    窗口对象的属性和方法: 在js最外层写的function可以还可以理解为window对象的一个方法.定义的变量也可以称之为window对象的一个属性.例如:window.alert("--- ...

  2. C#命名空间“Microsoft.Office”中不存在类型或命名空间名称的终极解决方法

    源地址:http://blog.csdn.net/zhu2695/article/details/41852267

  3. 20145305 《Java程序设计》第7周学习总结

    教材学习内容总结 1.只有Lambda表达式,参数的类型必须写出来,如果有目标类型,在编译程序可推断出类型的情况下,可以不写出 2.Lambda表达式本身是中性的,不代表任何类型的实例,可用来表示不同 ...

  4. 基于lucene实现自己的推荐引擎

    基于lucene实现自己的推荐引擎 推荐常用算法之-基于内容的推荐 推荐算法

  5. mysql 如何用root 登录

    mysql -uroot -p 如果没有密码,按两下回车就进去了

  6. (转).NET代码混淆实践

    今天突然对反编译.混淆感兴趣,在网上查了一些资料,文章大部分内容来源http://www.cnblogs.com/hsapphire/archive/2010/11/21/1883514.html. ...

  7. 推荐一个PHP在线代码运行的网站

    地址:http://www.manongjc.com/runcode 该网站可以运行php代码.html代码.js代码, 对于初学者来说,免去了安装环境这一步.

  8. jxl的API

    jxl的API 使用Windows操作系统的朋友对Excel(电子表格)一定不会陌生,但是要使用Java语言来操纵Excel文件并不是一件容易的事.在Web应用日益盛行的今天,通过Web来操作Exce ...

  9. Java中List转数组,必须带个参数

    public static void main(String[] args) { List<String> lst = new ArrayList(); lst.add("赵云 ...

  10. 如何去掉有背景图的a标签的边框

    有两种情况: 1.<a href="#" style="background:url(../images/download.png);"></ ...