zoukankan      html  css  js  c++  java
  • Codeforces Round #360 B

    Lovely Palindromes

    题意:给一个n,求第n大的长度为偶数的回文数字

    思路:只考虑回文的前一半数字,因为前面是高位,肯定优先满足高位,第n大是数字就是n,后半部分由回文自动满足得到,所以其实就是正着输出一遍,倒着再输出一遍

    AC代码:

    #include "iostream"
    #include "string.h"
    #include "stack"
    #include "queue"
    #include "string"
    #include "vector"
    #include "set"
    #include "map"
    #include "algorithm"
    #include "stdio.h"
    #include "math.h"
    #pragma comment(linker, "/STACK:102400000,102400000")
    #define ll long long
    #define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
    #define mem(a,x) memset(a,x,sizeof(a))
    #define mp(x,y) make_pair(x,y)
    #define pb(x) push_back(x)
    #define lrt (rt<<1)
    #define rrt (rt<<1|1)
    using namespace std;
    const long long INF = 1e18+1LL;
    const int inf = 1e9+1e8;
    const int N=1e5+100;
    const ll mod=1e9+7;
    
    ///BBBB
    char s[N];
    int main(){
        ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
        cin>>s+1;
        int l=strlen(s+1);
        for(int i=1; i<=l; ++i){
            cout<<s[i];
        }
        for(int i=l; i>=1; --i){
            cout<<s[i];
        }
        return 0;
    }
  • 相关阅读:
    java 放射机制简介
    java 放射机制简介
    后海日记(1)
    后海日记(1)
    java 发邮件 代码
    java 发邮件 代码
    hadoop学习笔记411
    hadoop学习笔记411
    swoole_table
    用swoole简单实现MySQL连接池
  • 原文地址:https://www.cnblogs.com/max88888888/p/7264975.html
Copyright © 2011-2022 走看看