简单题。

#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. spring中junit 提示Failed to load ApplicationContext

    错误提示: 1:java.lang.IllegalStateException: Failed to load ApplicationContext 2:Error creating bean wit ...

  2. Phalcon初认识

    Phalcon以c扩展交付的全堆栈php开发框架 基本功能 低开销:低内存消耗和CPU相比传统的框架 MVC和HMVC:模块.组件.模型.视图和控制器 依赖注入:依赖注入和位置的服务和它的本身他们的容 ...

  3. 洛谷 P2604 [ZJOI2010]网络扩容

    题目描述 给定一张有向图,每条边都有一个容量C和一个扩容费用W.这里扩容费用是指将容量扩大1所需的费用.求: 1. 在不扩容的情况下,1到N的最大流: 2. 将1到N的最大流增加K所需的最小扩容费用. ...

  4. js数字转金额,ajax调用接口,后台返回html(完整页面),打开新窗口并写入html

    一.转换成金额形式 function toMoney(num){ if(num){ if(isNaN(num)) { alert("金额中含有不能识别的字符"); return; ...

  5. HTTP请求头的具体含意

    为你详细解读HTTP请求头的具体含意 | 浏览:5763 | 更新:2012-03-16 16:41 当我们打开一个网页时,浏览器要向网站服务器发送一个HTTP请求头,然后网站服务器根据HTTP请求头 ...

  6. POI导出,开发中经常会遇到数据导出这样的问题,下面是我在开发中采用的解决方法,大家可以参考,具体的实现害的结合你自身的业务逻辑

    @RequestMapping(value = "/drawPayFailExport",method = RequestMethod.GET,produces = "a ...

  7. 21. SCHEMATA

    21. SCHEMATA 在MySQL中,SCHEMA是数据库,因此SCHEMATA表提供有关数据库的信息. SCHEMATA表有以下列: CATALOG_NAME :SCHEMA所属目录的名称.该值 ...

  8. C/C++函数指针详解(转)

    这两天在研究C/C++的函数指针,找到一篇讲解比较详细的博客,内容有点多,但是讲解得比较详细,适合初学者.特转之: 1.     无处不见的函数指针 使用函数指针可以设计出更优雅的程序,比如设计一个集 ...

  9. logging ,re 模块

    一,复习 # random: random() randint() choice() sample() # 序列化:对象需要持久化存储或传送 对象 => 字符串 # json: 用于传输 # - ...

  10. linux 定时任务(注意事项)

    1.在要执行的脚本中,执行其他脚本时,需要加入其他脚本需要的环境变量. 2.路径要写全,绝对路径.命令要写全,使用绝对路径的方式.