游客 Signup | Login
中文 | En

2183 - 打印字符图样

根据输入(N,M)输出N行M列的字符图样,如下图所示N=4, M=6

**
  **
     **
       **

Input

输入只有一对正整数N,M。

Output

输出N行M列星形图

Examples

Input

4 6

Output

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

Solution C++

#include <iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i =1;i<=n;i++){
		for(int j=0;j<i-1;j++){
			cout<<" ";
		}
		for(int k =1;k<=m;k++){
			cout<<'*';		
		}	
		cout<<endl;
	}
	return 0;
}

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