PAT (Advanced Level) 1031. Hello World for U (20)
简单题。
#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)的更多相关文章
- 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 ...
- PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642
PAT (Advanced Level) Practice 1019 General Palindromic Number (20 分) 凌宸1642 题目描述: A number that will ...
- 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 ...
- 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 ...
- 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 ...
- PAT (Advanced Level) 1104. Sum of Number Segments (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- PAT (Advanced Level) 1058. A+B in Hogwarts (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- PAT (Advanced Level) 1023. Have Fun with Numbers (20)
手动模拟一下高精度加法. #include<iostream> #include<cstring> #include<cmath> #include<algo ...
- 【PAT Advanced Level】1011. World Cup Betting (20)
简单模拟题,遍历一遍即可.考察输入输出. #include <iostream> #include <string> #include <stdio.h> #inc ...
随机推荐
- git 初识
现在平时用的都是SVN,感觉还是挺好用的.就是有的时候解决冲突的时候有点麻烦.但这样也是不可避免的. 今天看来下GIT,同样是版本控制,GIT的原理,和SVN还是不一样的.我个人的理解,SVN是对每个 ...
- Python 使用re模块实现正则表达式
# coding: utf-8 # Team : Quality Management Center # Author:Carson # Date :2019/6/21 10:41 # Tool :P ...
- DROP TRIGGER - 删除一个触发器定义
SYNOPSIS DROP TRIGGER name ON table [ CASCADE | RESTRICT ] DESCRIPTION 描述 DROP TRIGGER 将删除所有对一个现存触发器 ...
- DROP TABLE - 删除一个表
SYNOPSIS DROP TABLE name [, ...] [ CASCADE | RESTRICT ] DESCRIPTION 描述 DROP TABLE 从数据库中删除表或视图. 只有其所有 ...
- Linux常用的操作指令
1.pwd-显示当前所在位置 2.cd-进入当前目录 3.cd..-返回上一级目录 4..ls命令参数选项有很多,ls也是经常使用到的命令.如果不清楚命令的使用方式可以直接 ls --help来查看 ...
- ES6 第五章 字符串的新增方法 具体参照 http://es6.ruanyifeng.com
1.FormCodePoint 对象方法 用于从 Unicode 码点返回对应字符,可以识别原来es5不能识别的大于0xFFFF的码点. String.fromCodePoint(0x20BB7) / ...
- visual studio中使用vim快捷键
vsvim下载链接: https://marketplace.visualstudio.com/items?itemName=JaredParMSFT.VsVim 下载,关闭visual studio ...
- CentOS 6及7 丢失root密码解决方案
6.x系列 法一:使用光盘镜像 BIOS中设置CD-ROM启动——选择救援模式——系统被自动挂载到/mnt/sysimage下——选择进入shell start shell——进入shell命令行—— ...
- python计算圆面积
#coding=gbk #coding=utf-8 #-*- coding: UTF-8 -*- #调用math包处理相关的运算 import math #圆半径 r = 2 #计算圆面积π*r*r与 ...
- Linux I2C驱动
Linux I2C 驱动结构 i2c体系结构由三部分组成 i2C core i2c core提供了i2c 总线驱动 和 设备驱动的注册,注销方法 i2C and SMBus protocol 实现 i ...