题意:
  给出一串数字,要你输出它的回文数,就这么简单.

分析:
  可以用数组去做,也可以用reversed()函数(这个更简单).

代码如下:

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <iterator>z
#include <vector> using namespace std; #define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 10000010
#define MAXM 1000010 const int maxn = ;
int a[maxn]; int main()
{
string s;
while(cin>>s)
{
memset(a, , sizeof(a));
int i;
int len = s.size();
int c = ;
for(i = ; i < len; i++ )
a[c++] = s[i] - '';
int b = ;
for(i = *c-; i >= c; i-- )
a[i] = a[b++];
for(i = ; i < *c; i++ )
printf("%d", a[i]);
printf("\n");
} return ;
}
 #include <iostream>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <iterator>z
#include <vector> using namespace std; #define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 10000010
#define MAXM 1000010 int main()
{
string s;
cin >> s;
cout << s;
reverse(s.begin(), s.end()); //将字符串s中的顺序颠倒
cout << s << endl;
}

CodeForces 688B-Lovely Palindromes的更多相关文章

  1. CodeForces 688B Lovely Palindromes (水题回文)

    题意:给一个数n,让你找出长度为偶数,并且是第 n 个回文数. 析:你多写几个就知道了,其实就是 n,然后再加上n的逆序,不过n有点大,直接用string 好了. 代码如下: #include < ...

  2. codeforces 688B B. Lovely Palindromes(水题)

    题目链接: B. Lovely Palindromes time limit per test 1 second memory limit per test 256 megabytes input s ...

  3. Codeforces Round #360 (Div. 2) B. Lovely Palindromes 水题

    B. Lovely Palindromes 题目连接: http://www.codeforces.com/contest/688/problem/B Description Pari has a f ...

  4. CodeForces 1251B --- Binary Palindromes

    [CodeForces 1251B --- Binary Palindromes] Description A palindrome is a string t which reads the sam ...

  5. E - Lovely Palindromes

    Description Pari has a friend who loves palindrome numbers. A palindrome number is a number that rea ...

  6. CF688B Lovely Palindromes 题解

    Content 输入一个数 \(n\),输出第 \(n\) 个偶数位回文数. 数据范围:\(1\leqslant n\leqslant 10^{10^5}\). Solution 一看这吓人的数据范围 ...

  7. cf688B-Lovely Palindromes

    http://codeforces.com/problemset/problem/688/B B. Lovely Palindromes time limit per test 1 second me ...

  8. 套题 codeforces 360

    A题:Opponents 直接模拟 #include <bits/stdc++.h> using namespace std; ]; int main() { int n,k; while ...

  9. Codeforces Round #360 div2

    Problem_A(CodeForces 688A): 题意: 有d天, n个人.如果这n个人同时出现, 那么你就赢不了他们所有的人, 除此之外, 你可以赢他们所有到场的人. 到场人数为0也算赢. 现 ...

  10. dp --- Codeforces 245H :Queries for Number of Palindromes

    Queries for Number of Palindromes Problem's Link:   http://codeforces.com/problemset/problem/245/H M ...

随机推荐

  1. RobotFrameWork http/https oauth接口测试 (二)

    在RobotFrameWork http/https oauth接口测试 (一)中,大致介绍了相关的概念,终于可以步入正题了~~~ 先介绍下项目背景: 公司的项目采用的授权模式是第三种resource ...

  2. 为什么要加 -moz- -webkit- -ms- -o- ?

    没有别的,为了兼容早期版本,为了解决CSS3标准正式发布以前的遗留问题.

  3. Java判断访问设备为手机、微信、PC工具类

    package com.lwj.util; import javax.servlet.http.HttpServletRequest; /** * 判断访问设备为PC或者手机--工具类 * * @de ...

  4. php 全角半角转换

    <?phpheader("Content-type: text/html; charset=utf-8");// 第一个参数:传入要转换的字符串// 第二个参数:取0,半角转 ...

  5. (2) 深入理解Java Class文件格式(一)

    好文转载:http://blog.csdn.net/zhangjg_blog/article/details/21486985 Class文件在Java体系结构中的位置和作用 在上一篇博客中, 大致讲 ...

  6. c# this关键字的理解

    this关键字引用类的当前实例 1/限定被相似的名称隐藏的成员 2/将对象作为参数传递到其他方法 3/声明索引器 实际案例参考: //成员类 public class Employee { priva ...

  7. Openstack+Kubernetes+Docker微服务实践之路--基础设施

    近两年微服务在网上聊的如此的如火如荼,备受关注,我在去年下半年的一个项目中也用到了阿里云的EDAS.HSF,深有体会,最近时间空闲出于好奇,决定一探究竟打算自建微服务平台,基本实现EDAS.HSF的功 ...

  8. 翻译:在Ubuntu 14.04上安装FTP服务器的方法

    说明: 1.原文地址:http://www.krizna.com/ubuntu/setup-ftp-server-on-ubuntu-14-04-vsftpd/ 2.今天要做一个网络日志的迁移程序,搬 ...

  9. My97日期控件 选择日期区间

    <script language="javascript" type="text/javascript" src="My97DatePicker ...

  10. ie7 父元素宽度自适应且为浮动的话 子元素的宽度将不能按比例设置问题

    好久没切图,昨天遇到个浏览器兼容的老问题,在ie7下,父元素设置浮动后,其宽度是自适应的,子元素的宽度若没有确定则将显示最小宽度,即文本所占的宽度. 正常其他浏览器显示如下: ie7中显示效果如下: ...