您的位置:首页 > 其它

PAT(甲级)Hello World for U (20)

2017-01-21 22:34 501 查看
题目:https://www.patest.cn/contests/pat-a-practise/1031

代码:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int main()
{
char str[100];
gets(str);
int count=strlen(str);
int n1=(count+2)/3,n3=n1,n2=count+2-n1-n3;
for(int i=0;i<n1-1;i++){
printf("%c",str[i]);
for(int j=0;j<n2-2;j++){
printf(" ");
}
printf("%c\n",str[count-i-1]);
}
for(int i=0;i<n2;i++){
printf("%c",str[n1+i-1]);
}
system("pause");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: