样例对了为什么全wa
查看原帖
样例对了为什么全wa
1512270
xinnnnnnn楼主2025/1/14 19:26
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{int a;
cin>>a;
int k=1;
for(int i=1;i<=a;i++)
{for(int j=1;j<=a;j++)
{cout<<setw(2)<<setfill('0')<<k;
k++;
}
cout<<endl<<endl;
}
cout<<endl;
int c=1;

for(int i=1;i<=a;i++)
{for(int j=1;j<=2*(a-i);j++)
{cout<<" ";
}
for(int k=1;k<=i;k++)
{cout<<setw(2)<<setfill('0')<<c;
if(c==i*(i+1)/2)
{cout<<endl<<endl;
}
c++;
}
}
	
	
	
	
	return 0;
}
2025/1/14 19:26
加载中...