zoukankan      html  css  js  c++  java
  • codeforces 688B B. Lovely Palindromes(水题)

    题目链接:

    B. Lovely Palindromes

    time limit per test
    1 second
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.

    Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome numbers. Pari loves integers with even length (i.e. the numbers with even number of digits), so she tries to see a lot of big palindrome numbers with even length (like a 2-digit 11 or 6-digit 122221), so maybe she could see something in them.

    Now Pari asks you to write a program that gets a huge integer n from the input and tells what is the n-th even-length positive palindrome number?

    Input

    The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).

    Output

    Print the n-th even-length palindrome number.

    Examples
    input
    1
    output
    11
    input
    10
    output
    1001

    题意:

    问长度为偶数的第n个回文数是多少;

    思路:

    把这个字符串输出一遍再倒过来输出一遍就是答案了;

    AC代码:

    //#include <bits/stdc++.h>
    #include <vector>
    #include <iostream>
    #include <queue>
    #include <cmath>
    #include <map>
    #include <cstring>
    #include <algorithm>
    #include <cstdio>
    
    using namespace std;
    #define Riep(n) for(int i=1;i<=n;i++)
    #define Riop(n) for(int i=0;i<n;i++)
    #define Rjep(n) for(int j=1;j<=n;j++)
    #define Rjop(n) for(int j=0;j<n;j++)
    #define mst(ss,b) memset(ss,b,sizeof(ss));
    typedef  long long LL;
    template<class T> void read(T&num) {
        char CH; bool F=false;
        for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar());
        for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar());
        F && (num=-num);
    }
    int stk[70], tp;
    template<class T> inline void print(T p) {
        if(!p) { puts("0"); return; }
        while(p) stk[++ tp] = p%10, p/=10;
        while(tp) putchar(stk[tp--] + '0');
        putchar('
    ');
    }
    
    const LL mod=1e9+7;
    const double PI=acos(-1.0);
    const LL inf=1e18;
    const int N=1e5+20;
    const int maxn=1005;
    const double eps=1e-10;
    
    char s[N];
    int main()
    {
    
            scanf("%s",s);
            int len=strlen(s);
            for(int i=0;i<len;i++)
            {
                printf("%c",s[i]);
            }
            for(int i=len-1;i>=0;i--)
            {
                printf("%c",s[i]);
            }
    
            return 0;
    }
  • 相关阅读:
    20145307陈俊达《网络对抗》Exp6 信息搜集与漏洞扫描
    20145307陈俊达《网络对抗》Exp5 MSF基础应用
    微服务负载均衡 —— ribbon
    微服务注册与发现 —— eureka
    shiro
    unix网络编程——I/O多路复用之epoll
    unix网络编程——TCP套接字编程
    java异常处理及自定义异常的使用
    磁盘调度算法寻道问题
    关于mybatis的思考(3)——ResultMaps的使用
  • 原文地址:https://www.cnblogs.com/zhangchengc919/p/5629336.html
Copyright © 2011-2022 走看看