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. [转载]socket下server端支持多客户端并发访问简单实现

    /*Author: wainiwann *Source: 博客园 http://www.cnblogs.com/wainiwann *Remarks:  转载请说明出处!!! */ 感觉很不错,可以学 ...

  2. linux下zip文件解压后乱码解决方案

    解决办法一,利用pyton来处理 1.vi uzip文件2.复制一下内容(Python) #!/usr/bin/env python # -*- coding: utf-8 -*- # uzip.py ...

  3. ruby 字符串学习2

    在一个ruby字符串中包含表但是或者变量.想使用不同的值替换表达式或者变量 1 类似java 或者python的printf-style方式 template = 'Oceania has alway ...

  4. 20145305 《Java程序设计》实验一

    实验名称 实现凯撒密码,并进行测试. 实验内容 它是一种代换密码.据说凯撒是率先使用加密函的古代将领之一,因此这种加密方法被称为恺撒密码. 凯撒密码作为一种最为古老的对称加密体制,在古罗马的时候都已经 ...

  5. PYTHON ASYNCIO: FUTURE, TASK AND THE EVENT LOOP

    from :http://masnun.com/2015/11/20/python-asyncio-future-task-and-the-event-loop.html Event Loop On ...

  6. python metaclass 入门简介

    http://cizixs.com/2015/08/30/metaclass-in-python 动态类型也是类型 python 是一种动态类型语言,换句话说每个变量可以在程序里任何地方改变它的类型. ...

  7. Ext 4.2以后版本 ComboBox 联动

    //combox树 ComboTree: function (upDep, empStore) { var com = Ext.create('Ext.ux.desktop.ComboTree', { ...

  8. jQuery学习笔记----入门

    基础语法是:$(selector).action() 美元符号定义 jQuery 选择符(selector)“查询”和“查找” HTML 元素 jQuery 的 action() 执行对元素的操作

  9. ASP.NET fails to detect Internet Explorer 10

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9"> http://www.han ...

  10. Oracle数据库——函数 http://www.jb51.net/article/40469.htm

    1====分析函数  相当于把分组后的结果加到每一行里 SELECT  t.loan_contract_no,t.loan_name,t.loan_amount,ROWNUM,  row_number ...