Basic Practice Special Palindrome number

Source: Internet
Author: User

Basic Practice Special Palindrome numberTime limit: 1.0s memory Limit: 512.0MB problem description 123321 is a very special number, it reads from the left and reads from the right is the same.
Enter a positive integer n, programming all such five-bit and six-bit decimal numbers to satisfy the sum of the numbers equal to N. Enter a line in the format that contains a positive integer n. The output format outputs an integer that satisfies the condition in order from small to large, with each integer occupying one row. Example input 52 sample output 899998
989989
998899 Data size and convention 1<=n<=54.
ImportJava.util.*; Public classMain {Static intn = 0;  Public Static voidMain (string[] args) {inti; Scanner Cin=NewScanner (system.in); N=Cin.nextint ();  for(i = 10001; i< 999999; i++ ){            if(Huiwen (i)) System.out.println (i); }        }    Static BooleanHuiwen (intx) {        intI,s,j=0; intA[] =New int[8];  while(x>0) {a[j++]=x%10; X/=10; }       for(i=0; i<=j/2; i++)      {          if(A[i]!=a[j-1-i])return false; }        for(i=0,s=0; i<j; i++) {s+=A[i]; }      if(s==n)return true; Else return false; }}

Basic Practice Special Palindrome number

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.