数字三角形

#include<bits/stdc++.h>
using namespace std;
void rocket(int n) {
    int num = 1;
    for (int i = 1; i <= n; ++i)
	{ 
        for (int j = 1; j <= i; ++j)
		{
            cout << num++ << " ";
			        }
        cout << endl;
    }
}
int main() {
    int a;
    cin >> a;
    rocket(a);
    return 0;
}

其他两道做不出来

0 条评论

目前还没有评论...