标签:blog io for 问题 div log return on
问题:输出杨辉三角的第n行
class Solution { public: vector<int> getRow(int rowIndex) { vector<int> vec; int a[100][100]; a[0][0]=1; int j,i; for(i=1;i<=rowIndex;i++) { a[i][0]=1; for(j=1;j<i;j++) { a[i][j]=a[i-1][j-1]+a[i-1][j]; } a[i][j]=1; } for(i=0;i<=rowIndex;i++) vec.push_back(a[rowIndex][i]); return vec; } };
Pascal's Triangle II,布布扣,bubuko.com
标签:blog io for 问题 div log return on
原文地址:http://www.cnblogs.com/zsboy/p/3895330.html