题目链接

https://www.patest.cn/contests/gplt/L1-054

思路

可以先将字符串用字符串数组 输入

然后用另一个字符串数组 从 n - 1 -> 0 保存 其反转的字符串

然后每一行比较一下 这两个字符串数组有没有什么不同 如果没有 就要输出 bu yong dao le

然后最后 输出“到了” 的字符串 注意 字符替换

AC代码

#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits> #define CLR(a) memset(a, 0, sizeof(a))
#define pb push_back using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll; const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6; const int INF = 0x3f3f3f3f;
const int maxn = 1e2 + 5;
const int MOD = 1e9 + 7; string in[maxn], tran[maxn]; string Reverse(string s)
{
string ans = "";
int len = s.size();
for (int i = len - 1; i >= 0; i--)
ans += s[i];
return ans;
} int main()
{
char c;
int n;
scanf(" %c%d", &c, &n);
getchar();
for (int i = 0; i < n; i++)
{
getline(cin, in[i]);
tran[n - 1 - i] = Reverse(in[i]);
}
int flag = 1;
for (int i = 0; i < n; i++)
{
if (in[i] != tran[i])
{
flag = 0;
break;
}
}
if (flag)
printf("bu yong dao le\n");
for (int i = 0; i < n; i++)
{
int len = tran[i].size();
for (int j = 0; j < len; j++)
{
if (tran[i][j] != ' ')
printf("%c", c);
else
printf(" ");
}
printf("\n");
}
}

PAT 天梯赛 L1-054. 福到了 【字符串】的更多相关文章

  1. PAT天梯赛 L1-050 倒数第N个字符串

    题目链接:点击打开链接 给定一个完全由小写英文字母组成的字符串等差递增序列,该序列中的每个字符串的长度固定为 L,从 L 个 a 开始,以 1 为步长递增.例如当 L 为 3 时,序列为 { aaa, ...

  2. PAT 天梯赛 L1-025. 正整数A+B 【字符串处理】

    题目链接 https://www.patest.cn/contests/gplt/L1-025 思路 注意 输入字符串B的时候 要用getline 因为 可能存在空格 然后就把字符串 转化成 数字 并 ...

  3. PAT 天梯赛 L1-050. 倒数第N个字符串 【字符串】

    题目链接 https://www.patest.cn/contests/gplt/L1-050 思路 因为是求倒数 我们不如直接 倒过来看 令 zzz 为第一个字符串 我们可以理解为 十进制 转换为 ...

  4. PTA 天梯赛 L1

    L1-002 打印沙漏 细节:就是在  (i>j&&i+j<r+1) 这个区间里才有空格,然后就是 for 循环   for(r=1; ;r+=2)  条件不满足之后还会再 ...

  5. PAT天梯赛 L1-049 天梯赛座位分配

    题目链接:点击打开链接 天梯赛每年有大量参赛队员,要保证同一所学校的所有队员都不能相邻,分配座位就成为一件比较麻烦的事情.为此我们制定如下策略:假设某赛场有 N 所学校参赛,第 i 所学校有 M[i] ...

  6. PAT天梯赛L3-007 天梯地图

    题目链接:点击打开链接 本题要求你实现一个天梯赛专属在线地图,队员输入自己学校所在地和赛场地点后,该地图应该推荐两条路线:一条是最快到达路线:一条是最短距离的路线.题目保证对任意的查询请求,地图上都至 ...

  7. PAT天梯赛练习题——L3-007. 天梯地图(多边权SPFA)

    L3-007. 天梯地图 时间限制 300 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 本题要求你实现一个天梯赛专属在线地图,队员输入自己学校 ...

  8. PAT天梯赛L1-054 福到了

    题目链接:点击打开链接 "福"字倒着贴,寓意"福到".不论到底算不算民俗,本题且请你编写程序,把各种汉字倒过来输出.这里要处理的每个汉字是由一个 N x N 的 ...

  9. PAT天梯赛练习题 L3-002. 堆栈(线段树查询第K大值或主席树)

    L3-002. 堆栈 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 大家都知道“堆栈”是一种“先进后出”的线性结构,基本操作有 ...

随机推荐

  1. nVidia的物理系统

    PhysX PhysX(wiki en  中文,physx wiki   physx wiki2)是nVidia公司一款跨平台实时物理引擎,可使用硬件(GPU.PPU: Physics Process ...

  2. ORA-12514: TNS:listener does not currently know of service requested in connect

    https://blog.csdn.net/mchdba/article/details/50166153

  3. 东方14ACM小组 15:Challenge 11

    Challenge 11 查看 提交 统计 提问 总时间限制:  10000ms 单个测试点时间限制:  1000ms 内存限制:  262144kB 描述 给一个长为N的数列,有M次操作,每次操作是 ...

  4. IIS下安装memcached管理工具—MemAdmin

    1.先看这篇文章 http://www.cnblogs.com/joylee/archive/2013/01/07/memadmin.html . 2.在IIS下安装的php-cgi.exe程序版本为 ...

  5. php 打印今天,昨天,本周,上周,当月,上月,本季,上季,今年,去年数据

    if($filter['mode']) { switch ($filter['mode']) { case 1://今天的数据 $time_start = date("Y-m-d H:i:s ...

  6. VirtualApp技术黑产利用研究报告

    一. 前言 VirtualApp(以下称VA)是一个App虚拟化引擎(简称VA).VirtualApp创建了一个虚拟空间,你可以在虚拟空间内任意的安装.启动和卸载APK,这一切都与外部隔离,如同一个沙 ...

  7. phonegap工程搭建基础(一)

      官网:http://cordova.apache.org   一.环境配置 1. 安装Cordova   on OS X and Linux: $ sudo npm install -g cord ...

  8. Android最佳实践之Material Design

    Material概述及主题 学习地址:http://developer.android.com/training/material/get-started.html 使用material design ...

  9. 利用反射快速给Model实体赋值 使用 Task 简化异步编程 Guid ToString 格式知多少?(GUID 格式) Parallel Programming-实现并行操作的流水线(生产者、消费者) c# 无损高质量压缩图片代码 8种主要排序算法的C#实现 (一) 8种主要排序算法的C#实现 (二)

    试想这样一个业务需求:有一张合同表,由于合同涉及内容比较多所以此表比较庞大,大概有120多个字段.现在合同每一次变更时都需要对合同原始信息进行归档一次,版本号依次递增.那么我们就要新建一张合同历史表, ...

  10. 在eclipse中查找指定文件 [多种方法]

    在eclipse中查找指定文件   1.ctrl+h打开搜索界面 File Search: containing text填*,File name patterns填写hello.*,可以找到hell ...