= =就是个模拟题
class Solution { public: vector<vector<int> > generate(int numRows) { // Start typing your C/C++ solution below // DO NOT write int main() function vector<vector<int> > ans; vector<int> tmp; if(numRows == 0) return ans; tmp.push_back(1); ans.push_back(tmp); for(int i = 1 ; i < numRows ; i++){ int len = ans[i-1].size(); tmp.clear(); tmp.push_back(1); for(int j = 1 ; j < len ; j++) { int num = ans[i-1][j] + ans[i-1][j-1]; tmp.push_back(num); } tmp.push_back(1); ans.push_back(tmp); } return ans; } };