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 ...
随机推荐
- jQuery图片延迟加载插件jQuery.lazyload
插件描述:jQuery图片延迟加载插件jQuery.lazyload,使用延迟加载在可提高网页下载速度.在某些情况下,它也能帮助减轻服务器负载. 使用方法 引用jquery和jquery.lazy ...
- 利用js将 json对象在textarea中赋值与展示
明明很简单的东西,可惜网上一大堆废话.在此记录,转需. jsonStr = JSON.stringify(jsondata,); example: <!doctype html> < ...
- PDF按模板出力,多个PDF合并
const string TEMP_PREXFIX = "Temp_"; ...
- javascript数组去重的三种常用方法,及其性能比较
在进行数组操作时往往会遇到去掉重复项的问题,下面简单介绍下数组去重的方法,以及其执行效率 方法一 采用两次循环 原理:拿当前的和他后面的比,如果后面的有重复的就干掉 ...
- DedeCms完美的FLASH幻灯代码
<div id="banner"> <script language='javascript'> linkarr = new Array(); picarr ...
- Replace JSON.NET with Jil JSON serializer in ASP.NET Web API
I have recently come across a comparison of fast JSON serializers in .NET, which shows that Jil JSON ...
- Microsoft Visual C++ 2015 Redistributable(x64) - 14.0.2306 设置失败
想要在Windows 2008 R2 中 安装PHP, 需要安装 Microsoft Visual C++ 2015 Redistributable(x64) ,结果提供设置失败. 先中找到以下文字, ...
- Export excel file using web API
使用MVC controller输出excel的例子,自不待言,例子满天飞. 由于本项目使用的是Asp.net MVC API,因此在本项目使用API,实现了文件下载功能.代码的原理很简单,基本上是老 ...
- Celery 使用简介
转自:http://liuzxc.github.io/blog/celery/ Celery 是一个简单.灵活且可靠的,处理大量消息的分布式系统,它是一个专注于实时处理的任务队列, 同时也支持任务调度 ...
- Hibernate 实体关联关系映射【转】
Hibernate关联关系映射目录│ ├─单向关联│ ├─ 一对一外键单向关联│ ├─ 一对一主键单向关联│ ├─ 一对一连接表单向关联│ ├─ 一对多外键单向关联│ ├─ 一对多 ...