资源限制
时间限制:1.0s 内存限制:512.0MB
问题描述
编写一个程序,首先输入一个整数,例如5,然后在屏幕上显示如下的图形(5表示行数):
* * * * *
* * * *
* * *
* *
*
#include<iostream>
#include<algorithm>
using namespace std;
//ALGO-97 排序 循环语句
int main()
{
int n;
cin>>n;
int a[n + 1][n + 1];
for(int i = 1; i <= n; i++)
{
cout<<'*';
for(int j = 2; j <= n - i + 1; j++)
cout<<" *";
cout<<'\n';
}
return 0;
}
水