1.题目
2.代码
class Solution {
public:
string convert(string s, int numRows) {
if (numRows <= 1)
return s;
string res = "";
int size = 2 * numRows - 2;
for (int i = 0; i < numRows; ++i)
{
for (int j = i; j < s.size(); j += size)
{
res += s[j];
int tmp = j + size - 2 * i;
if (i != 0 && i != numRows - 1 && tmp < s.size())
res += s[tmp];
}
}
return res;
}
};