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位数字的乘积的最大回文。
1 import java.util.ArrayList; 2 import java.util.List; 3 4 public class Main 5 { 6 public static void main(String[] args) 7 { 8 Listlist = new ArrayList (); 9 int a=0;10 for(int i=99;i<1000;i++)11 {12 for(int j=99;j<1000;j++)13 {14 list.add(j*i);15 }16 }17 List lis = new ArrayList ();18 for(int i=0;i 100000)21 {22 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)23 {24 lis.add(list.get(i));25 }26 }27 }28 int max=lis.get(0);29 for(int i=0;i
结果:
906609
posted on 2016-08-22 17:01 阅读( ...) 评论( ...)