可能我还很差


私信TA

用户名:dotcpp0606413

访问量:154

签 名:

努力跟着大佬们学习,加油!

等  级
排  名 3915
经  验 1734
参赛次数 0
文章发表 10
年  龄 0
在职情况 学生
学  校 中国计量大学
专  业

  自我简介:

一个不敬业的研究生,研究光谱,却整天想着敲代码!

解题思路:

注意事项:

参考代码:

#include<iostream>

using namespace std;

int main()

{

int n = 0;

int a[20][20] = { 0 };

int s = 1;

cin >> n;

for (int i = 1; i <= n; i++)

{

int temp = i;

int t = i;

int j = 1;

while (j<= temp)

{

a[t][j] = s;

j++;

t--;

s++;

}

}

int j = 1;

int t3 = n;

while (1)

{

for (int i = 1; i <= n; i++)

{

if (j != t3)

{

cout << a[j][i] << " ";

}

else

{

cout << a[j][i];

}

}

cout << endl;

n--;

j++;

if (j-1 == t3)

{

break;

}

}


system("pause");




}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区