The conjecture of palindrome number

Source: Internet
Author: User

.... The science and technology used a long long before ...
1#include <stdio.h>2#include <string.h>3#include <math.h>4#include <iostream>5#include <algorithm>6#include <queue>7#include <vector>8#include <Set>9#include <stack>Ten#include <string> One#include <sstream> A#include <map> -#include <cctype> -#include <limits.h> the using namespacestd; - __int64 Finte (__int64 Integer) - { -__int64 finteger=0; +      while(integer!=0) -     { +finteger+=integer%Ten; Ainteger=integer/Ten; atfinteger=finteger*Ten; -     } -finteger=finteger/Ten; -     returnFinteger; - } - BOOLispalindrome (__int64 icandidate) in { -     if(icandidate<0)//negative numbers are definitely not palindrome . to         return false; +     Else -     { the         if(icandidate<=9)//An integer of length 1 must be a palindrome. *             return true; $         ElsePanax Notoginseng         { -             //Get reversal Value the__int64 isrc=icandidate; +__int64 idst=0; A__int64 ipivot=0; the__int64 ipower=0; +             //get the reversal value of Icandidate -              while(isrc!=0) $             { $idst=idst*Ten+isrc%Ten; -isrc=isrc/Ten; -             } the             //compare positive and reverse values; if consistent, it is palindrome; otherwise, it's not a palindrome. -             if(idst==icandidate)Wuyi                 return true; the             Else -                 return false; Wu         } -     } About } $ intMain () - { -__int64 n,a[10000],flag; -      while(SCANF ("%i64d", &n)! =EOF) A     { +         intmark=flag=0; thea[flag++]=N; -          while(!ispalindrome (n)) $         { then=n+Finte (n); thea[flag++]=N; themark++; the         } -printf"%i64d\n", Mark); inprintf"%i64d", a[0]); the          for(intI=1; i<flag;i++) theprintf"--->%i64d", A[i]); Aboutprintf"\ n"); the     } the     return 0; the}

The conjecture of 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.