- #include<iostream>
- #include<string>
- #include<algorithm>
- using namespace std;
- int main()
- {
- freopen("in.in", "r", stdin);
- freopen("out.out","w", stdout);
- //输入部分
- char input[81];
- while(cin >> input)
- {
- string s = input;
- int len = s.length();
- //计算部分
- int n1,n2, n3,i,j;
- n1 = n3 =(len + 2) / 3 -1;
- n2 = len - n1 - n3;
- string left,right, bottom;
- left = s.substr(0,n1);
- right = s.substr(len-n3,n3);
- bottom = s.substr(n1,n2);
- reverse(right.begin(),right.end());
- for (i=0; i<n1; i++)
- {
- cout << left[i];
- for (j=0; j<n2-2; j++)
- cout << " ";
- cout << right[i] << endl;
- }
- cout << bottom << endl;
- }
- return 0;
- }
题目1464
最新推荐文章于 2022-03-05 11:10:38 发布