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

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,…
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…
题目: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…
题目链接:http://www.patest.cn/contests/pat-a-practise/1031 题目: 分析: 排版题.注意先计算好最后一排的字符数,然后计算前面几排的空格数.难度不大 这里有个小技巧,就是先把要输出的结果都存储到ouput[ ]字符数组中.等所有拍好后再输出output[ ]就可以.这样能够方便得写处于右边的一列的循环. AC代码: #include<stdio.h> #include<string> using namespace std; cha…
#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…
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…
1031. Hello World for U (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 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…