7 条题解
-
0
/* * * * * * * * * * * * * */ #include <iostream> using namespace std; const int INF = 0x3f3f3f3f; const int N = 1e5 + 10; int n; int main() { cin >> n; //首行 for(int i = 1; i <= n; i++) cout << " "; cout << "*" << endl; //上半部分 for(int i = 1; i <= n; i++) { //空格 for(int j = 1; j <= n - i; j++) cout << " "; cout << "*"; //中间空格 for(int j = 1; j <= 2 * i - 1; j++) cout << " "; cout << "*" << endl; } //下半部分 for(int i = 1; i <= n - 1; i++) { //空格 for(int j = 1; j <= i; j++) cout << " "; cout << "*"; //中间空格 for(int j = 1; j <= 2 * n - 1 - 2 * i; j++) cout << " "; cout << "*" << endl; } //最后一行 for(int i = 1; i <= n; i++) cout << " "; cout << "*" << endl; return 0; }
信息
- ID
- 952
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 2
- 标签
- 递交数
- 355
- 已通过
- 219
- 上传者