-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1031.cpp
More file actions
38 lines (35 loc) · 694 Bytes
/
1031.cpp
File metadata and controls
38 lines (35 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// 1031.cpp
// 算法
//
// Created by 王怡凡 on 2017/8/21.
// Copyright © 2017年 王怡凡. All rights reserved.
//
#include <stdio.h>
#include<cstring>
#include<algorithm>
using namespace std;
char s[90];
int main() {
scanf("%s",s);
int i,j,len=int(strlen(s)),a,b;
a = min((len-1)/2,(len+2)/3);
b = len+2-2*a;
for(i=0;i<a-1;i++) {
printf("%c",s[i]);
for(j=0;j<b-2;j++) {
printf(" ");
}
printf("%c",s[len-i-1]);
printf("\n");
}
for(j=0;j<b;j++) {
printf("%c",s[i]);
i++;
}
// for(j=b/2;j<b;j++) {
// printf("%c",s[len-i-1]);
// i++;
// }
return 0;
}