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. 树莓派学习:源码方式安装opencv

    1:下载若干依赖项: 更新软件源:sudo apt-get update/upgrade; 依次安装一下依赖项:   sudo apt-get install build-essential   su ...

  2. Apache Thrift学习之一(入门及Java实例演示)

    目录: 概述 下载配置 基本概念 数据类型 服务端编码基本步骤 客户端编码基本步骤 数据传输协议 实例演示(java) thrift生成代码 实现接口Iface TSimpleServer服务模型 T ...

  3. 使用Nlog记录日志到数据库

    Nlog是一个很不错的.NET日志记录组件,它可以将日志输出到控件台,保存到文本,也可以很方便的记录到数据库中. 可以在这里下载Nlog:http://nlog-project.org/ 这里分享一下 ...

  4. Oracle中常用操作

    查看表中的字段名和类型 SELECT column_name,DATA_TYPE FROM cols WHERE TABLE_NAME=upper('tableName') ORDER BY COLU ...

  5. javascript 传递引用类型参数

    JavaScript代码如下: function setName(obj){ obj.name = "test1"; obj = new Object(); obj.name = ...

  6. [SQL]一组数据中Name列相同值的最大Je与最小je的差

    declare @t table(name varchar(),qy varchar(),je int) insert into @t union all union all union all un ...

  7. 2015 ACM/ICPC Asia Regional Beijing Online

    时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 You must have seen the very famous movie series,"Mission ...

  8. Configuring HugePages for Oracle on Linux (x86-64)

    Introduction Configuring HugePages Force Oracle to use HugePages (USE_LARGE_PAGES) Disabling Transpa ...

  9. OC基础(24)

    NSMutableArray基本概念 NSDictionary基本概念 NSMutableDictionary基本概念 常见的结构体 *:first-child { margin-top: 0 !im ...

  10. gcc编译, gdb调试, makefile写法

    //test.c: #include <stdio.h> int main(void) { printf("hello world!"); return 0; } == ...