游客 Signup | Login
中文 | En

3877 - 4.18(2) 使用循环语句打印图案

编写程序,提示用户输入一个在1到30之间的整数,然后显示一个正倒三角形状的图案。

Input

输入一个在1到30之间的整数n


Output

显示一个n行正倒三角形状的图案,每个数字之间空一格。如:

6 5 4 3 2 1 

5 4 3 2 1 
4 3 2 1 
3 2 1 
2 1 

<div>
	<br />
</div>


Examples

Input

6

Output

6 5 4 3 2 1 
5 4 3 2 1 
4 3 2 1 
3 2 1 
2 1 
1 

Hint

大于9的数字占2位

Solution C++

#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    int n;
    cin>>n;
    for(int i=n;i>=1;i--)
    {
        // cout<<i<<endl;
        for(int j=i;j>=1;j--)
        {
            cout<<j<<" ";
        }
        cout<<endl;
    }
    return 0;
}

Hint

大于9的数字占2位

Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题