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 ...
随机推荐
- purple-class2-默认选项切换
ylbtech-class:purple-class2 A, 返回顶部 1,默认选项切换 #region 默认选项切换 public delegate IList<SelectListItemI ...
- CentOS 防火墙打开和关闭端口(转载)
From:http://jianzhong5137.blog.163.com/blog/static/982904920126202313376/ http://soft.chinabyte.com/ ...
- netty入门实例
TimeServer.java package netty.timeserver.server; import io.netty.bootstrap.ServerBootstrap; import i ...
- Java基础-事件处理
- IDEA激活服務器
IDEA: http://www.iteblog.com/idea/key.php webstorm11:http://15.idea.lanyus.com/
- Tornado源码分析系列之一: 化异步为'同步'的Future和gen.coroutine
转自:http://blog.nathon.wang/2015/06/24/tornado-source-insight-01-gen/ 用Tornado也有一段时间,Tornado的文档还是比较匮乏 ...
- SAP_20140304
1. SAP 主打产品 R/3 :分布式 客户端/服务器 环境的标准ERP软件. 2. 主要功能模块:销售和分销,物料管理,生产计划,质量管理,工厂维修,人力资源,工业方案,办公室和通信,项目系统 ...
- POJ 1743 后缀数组不重叠最长重复子串
#include<stdio.h> #include<string.h> #include<algorithm> #define maxn 30000 using ...
- spark1.2.0版本SparkSQL使用parquet类型注意事项
在Spark1.2.0版本中是用parquet存储类型时注意事项: sql语句: select * from order_created_dynamic_partition_parquet; 在spa ...
- NOIP 2005 过河
过河 Time Limit: 1000MS Memory Limit: 65536K 题目描述 在河上有一座独木桥,一只青蛙想沿着独木桥从河的一侧跳到另一侧.在桥上有一些石子,青蛙很讨厌踩在这些石 ...