游客 Signup | Login
中文 | En

3290 - 图形打印等腰三角形

输入一个n,输出一个n行的等腰三角形。

输入3

输出

  *

 ***

*****

 

输入5

输出

     *

   ***
  *****
 *******
*********

Input

Output

Examples

Input


                

Output


                

Solution C++

#include<bits/stdc++.h>
using namespace std;
long long n;
int main()
{
	cin>>n;
    for(int i=1,j=n-1,k=1;i<=n;i++,j--,k+=2)
    {
    	for(int o=1;o<=j;o++)
    	cout<<' ';
    	for(int o=1;o<=k;o++)
    	cout<<'*';
    	cout<<endl;
	 } 
    return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题