Section 1.2.5 Dual palindromes water

Source: Internet
Author: User
Tags first string

Http://www.wzoi.org/usaco/11%5C302.asp

Pat

It's not too much water, there's nothing to say.

However, if the feeling does not cost, the first string reverse again compare whether the same to judge Palindrome, good convenience pat

#include <bits/stdc++.h>using namespacestd;BOOLGaoint Base,intN) {    intI, J; stringAns ="";  while(n) {ans+ = n%Base+'0'; N/=Base; }    stringrev (ans);    Reverse (Rev.begin (), Rev.end ()); returnRev = =ans;}intMain () {Freopen ("dualpal.in","R", stdin); #ifndef Poi Freopen ("Dualpal.out","W", stdout); #endif    intI, J, N, beg, cnt =0; scanf ("%d%d", &n, &Beg);  for(i = Beg +1; CNT < n; i++){        int Get=0;  for(j =2;Get<2&& J <=Ten; J + +){            if(Gao (J, i))Get++; }        if(Get==2) {printf ("%d\n", i); CNT++; }    }    return 0;}

Section 1.2.5 Dual palindromes water

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.