文章目錄
1. 題目描述
1.1. Limit
Time Limit: 1000 ms
Memory Limit: 131072 kB
1.2. Problem Description
輸入一個數,輸出層圖形,見下(圖爲的情況)
*
***
*****
*******
1.3. Input
輸入一個數
1.4. Output
輸出相應的圖形
1.5. Sample Input
5
1.6. Sample Output
*
***
*****
*******
*********
1.7. Source
2. 解讀
假設行號爲 ,,每一行輸出 個符號 。
3. 代碼
#include <iostream>
using namespace std;
int main()
{
long long n;
// 讀入n
scanf("%lld", &n);
// 輸出圖形
for (int i = 0; i < n; i++) {
for (int j = 0; j < 2 * i + 1; j++) {
printf("*");
}
printf("\n");
}
}
聯繫郵箱:[email protected]
Github:https://github.com/CurrenWong
歡迎轉載/Star/Fork,有問題歡迎通過郵箱交流。