
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int n;cin>>n;
n--;
int temp=0,sum=1,sumi=0,sumj=0;
for(int i=0;i<=n;i++)
{
sum+=sumj;
temp=sum;
sumi=sumj+2;
for(int j=0;j<=n-i;j++)
{
if(j==n-i&&i==n)
printf("%dn",temp);
else if(j==n-i&&i!=n)
printf("%dn",temp+sumi);
else if(j==0)
printf("%d ",temp);
else
{
temp+=sumi;
sumi++;
printf("%d ",temp);
}
}
sumj++;
}
return 0;
}
最后
以上就是笨笨寒风最近收集整理的关于蓝桥杯训练 B. 蛇行矩阵(第一周)的全部内容,更多相关蓝桥杯训练内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复