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

题目:http://pat.zju.edu.cn/contests/pat-a-practise/1031 分析: 简单题,调整数组的输出次序就可以了. 输入数组长度为len.n1 = n3 = (len+2)/3;   n2 = len - n1 - n3; 第一行最左边对应的是原数组的第一个字符,最后边对应的是原数组的最后一个字符.总共输出n1行. 题目描述: Given any string of N (>=5) characters, you are asked to form the…
PAT (Advanced Level) Practice 1031 Hello World for U (20 分) 凌宸1642 题目描述: Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l l r lowo That is, the charact…
1031 Hello World for U (20 分)   Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l l r lowo That is, the characters must be printed in the original order,…
今天刚刚到学校,2017年学习正式开始了,今天看到了浙大的<数据结构>这学期又要开课了,决定一定要跟着学习一遍:在大学生mooc网上学习:http://www.icourse163.org/course/zju-93001#/info :然后就是跟着<算法之美>也要同步看完. 然后就在PAT上随便做一道题,这是第一次通过AC,发现了两个比较好的博客主页:http://www.liuchuo.net/  和  https://www.joyhwong.com/   都总结了刷题的过程…
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> using namespace std; int n; int n1,n2,n3; ]; int main() { scanf("%s",str); n=strlen(str); n1=n3=(n+)/; n2=n+-n1-n3; //p…
简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<cstdio> #include<map> #include<queue> #include<vector> using namespace std; ]; int n1,n2,n3; ][]; int main() { scanf(&qu…
Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l l r lowo That is, the characters must be printed in the original order, starting top-down from the left…
题意: 输入一个字符串长度为5~80,以'U'型输出,使得底端一行字符数量不小于侧面一列,左右两列长度相等. trick: 不把输出的数组全部赋值为空格为全部答案错误,可能不赋值数组里值为0,赋值后是' ',空格的ascii是32,初读题面时并没有看到要输出空格,因为打印0其实效果看起来好像一样... AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; stri…
题目:http://pat.zju.edu.cn/contests/pat-a-practise/1027 简单题,考察十进制数和n进制数的转换和输出格式的控制. People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digi…
题目链接:http://www.patest.cn/contests/pat-a-practise/1031 题目: 分析: 排版题.注意先计算好最后一排的字符数,然后计算前面几排的空格数.难度不大 这里有个小技巧,就是先把要输出的结果都存储到ouput[ ]字符数组中.等所有拍好后再输出output[ ]就可以.这样能够方便得写处于右边的一列的循环. AC代码: #include<stdio.h> #include<string> using namespace std; cha…