简单题。

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<map>
#include<queue>
#include<vector>
using namespace std; char s[];
int n1,n2,n3;
char ans[][]; int main()
{
scanf("%s",s);
int len=strlen(s);
for(int i=;i<=len;i++)
{
if(i<=len+-i-i){
n1=i;
n3=i;
n2=len+-n1-n3;
}
} for(int i=;i<=n1;i++)
for(int j=;j<=n2;j++)
ans[i][j]=' ';
int tot=;
for(int i=;i<=n1;i++) ans[i][]=s[tot++];
tot--;
for(int i=;i<=n2;i++) ans[n1][i]=s[tot++];
tot--;
for(int i=n1;i>=;i--) ans[i][n2]=s[tot++]; for(int i=;i<=n1;i++){
for(int j=;j<=n2;j++) printf("%c",ans[i][j]);
printf("\n");
}
return ;
}

PAT (Advanced Level) 1031. Hello World for U (20)的更多相关文章

  1. PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1027 Colors in Mars (20 分) 凌宸1642 题目描述: People in Mars represent the c ...

  2. PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642 题目描述: A number that will ...

  3. PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1011 World Cup Betting (20 分) 凌宸1642 题目描述: With the 2010 FIFA World Cu ...

  4. PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642 题目描述: Given a non-negative integer N ...

  5. PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1001 A+B Format (20 分) 凌宸1642 题目描述: Calculate a+b and output the sum i ...

  6. PAT (Advanced Level) 1104. Sum of Number Segments (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  7. PAT (Advanced Level) 1058. A+B in Hogwarts (20)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  8. PAT (Advanced Level) 1023. Have Fun with Numbers (20)

    手动模拟一下高精度加法. #include<iostream> #include<cstring> #include<cmath> #include<algo ...

  9. 【PAT Advanced Level】1011. World Cup Betting (20)

    简单模拟题,遍历一遍即可.考察输入输出. #include <iostream> #include <string> #include <stdio.h> #inc ...

随机推荐

  1. python+selenium(python基础)

    1.编辑器的选择 好刀不误砍柴工,那么我们写代码也需要一个利器,虽然python自带有python shell ,但我们在执行代码的时候,需要开很多窗口,最重要的一点是,代码文件的管理很不方便,笔者推 ...

  2. rmdir

    rmdir——删除空目录 remove empty directories 命令所在路径:bin/rmdir 示例: # rmdir /tmp/japan/longze 删除/tmp/japan/目录 ...

  3. (转)SpringMVC学习(十二)——SpringMVC中的拦截器

    http://blog.csdn.net/yerenyuan_pku/article/details/72567761 SpringMVC的处理器拦截器类似于Servlet开发中的过滤器Filter, ...

  4. 简洁的KVO -- 使用Block响应事件

    涉及内容: KVO,Runtime,Category,Block 首先创建NSObject的Category 举个例子是这样的: 随后定义你需要响应的Block结构 我简单一点就这样咯 typedef ...

  5. HashSet LinkedHashSet TreeSet 分析

    1.HashSet分析 hashset 底层是hash表,就是hashMap,是无序的,唯一的.也就是说,它的底层其实就是一个HashMap  key 值的组成值.所以具有唯一性. public Ha ...

  6. Mysql is not allowed to connect mysql server

    1.     mysql -u root -p 2.    select host from user where user='root';      //可以看到当前主机配置信息为localhost ...

  7. dom和bom是什么?

    DOM:文档对象模型,描述了处理网页内容的方法和接口.最根本对象是document(window.document). 由于DOM的操作对象是文档,所以DOM和浏览器没有直接关系. 部署在服务器上的文 ...

  8. 背包DP || Codeforces 544C Writing Code

    程序员写bug的故事23333 题意:n个程序员,一共写m行程序,最多产生b个bug,问方案数 思路:f[i][j]表示写了i行,产生了j个bug的方案数,因为每个人都是可以独立的,所以i循环到n都做 ...

  9. PHP05 PHP语言基础

    学习要点 初识PHP 基础语法 变量 常量 运算符 表达式 学习目标 掌握PHP基础语法 掌握PHP变量 掌握PHP常量 掌握PHP表达式 掌握PHP运算符 初识PHP 第一个PHP程序 编写代码 1 ...

  10. 开源代码生成器,基于mybatis-generator扩展,结合freemarker

    git源码地址:https://github.com/JonSnow592622272/free-generator-code 码云gitee源码地址:https://gitee.com/a59262 ...