1 #include<cstdio> 2 #include<cstring> 3 int main(){ 4 char str[101]; 5 scanf("%s", str); // gets(str); 6 int N = strlen(str); 7 int n1 = ( N + 2 ) / 3, n3 = n1, n2 = N + 2 - n1 - n3; 8 for(int i = 0; i < n1; i++){ 9 if(i != n1-1){ 10 printf("%c", str[i]); 11 for(int j = 0; j < n2 -2; j++){ 12 printf(" "); 13 } 14 printf("%c\n", str[N-i-1]); 15 } 16 else{ 17 for(int k = n1-1; k < n1 + n2 -1; k++){ 18 printf("%c",str[k]); 19 } 20 } 21 } 22 return 0; 23 }
PAT 甲级 A1031 (2019/02/08)
猜你喜欢
转载自www.cnblogs.com/zjsaipplp/p/10415783.html
今日推荐
周排行