文章

58

粉丝

0

获赞

92

访问

6.2k

头像
字符棱形 题解:c++,难绷,写的好怪
P1473 杭州电子科技大学机试题
发布于2026年2月1日 14:10
阅读数 72

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int c ;
    cin >> c ;
    int n = 2*c - 1;
    int temp1 = n / 2;
    int temp2 = 1;
    int temp3 = n - 2;
    int temp4 = 1;
    for(int i = 0; i < c ; i++){          //上半部分
        for(int j = 0; j < temp1; j++){   //空格
            cout << " ";
        }
        for(int j = 0; j < temp2; j++){   //*
            cout << "*";
        }
        temp1--;
        temp2 += 2;
        cout << endl;
    }
    for(int i = 0; i < c - 1 ; i++){      //下半部分
        for(int...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发