1031. Hello World for U (20)
#include <iostream>
#include <string.h>using namespace std;int main()
{char s[100];gets(s);int n1, n2, n = strlen(s), flag = 0;for(n2 = 3; n2 <= n; n2++){for(n1 = n2; n1 >= 1; n1--){if(n1 * 2 + n2 - 2 == n){flag = 1;break;}}if(flag == 1){break;}}int i, j;for(i = 0; i <= n1 - 2; i++){printf("%c", s[i]);for(j = 1; j <= n2 - 2; j++){printf(" ");}printf("%c\n", s[n - i - 1]);}for(i = n1 - 1; i <= n1 + n2 - 2; i++){printf("%c", s[i]);}printf("\n");system("pause");return 0;
}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/974044.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!