1031. Hello World for U (20)

    xiaoxiao2021-03-26  2

    #include<iostream> #include<string> #include<algorithm> using namespace std; int main(){ string s; cin>>s; int n = s.size(); int n1, n2; for(n1 = 1; n1 <= n + 2 - 2 * n1 && n + 2 - 2 * n1 >= 3 && n + 2 - 2 * n1 <= n; n1++); n1--; n2 = n + 2 - 2 * n1; for(int i = 0; i < n1 - 1; i++){ printf("%c",s[i]); for(int j = 0; j < n2 - 2; j++){ printf(" "); } printf("%c\n",s[n - 1 - i]); } for(int i = n1 - 1; i < n1 - 1 + n2; i++){ printf("%c",s[i]); } return 0; }
    转载请注明原文地址: https://ju.6miu.com/read-650174.html

    最新回复(0)