The answer seems right.

```
class Solution {
public:
string convert(string s, int nRows) {
int i,j;
string r="";
for(j=1;j<=nRows;j++){
if(j==1){
i=1;
while(i-1<s.length()){
r+=s[i-1];
i+=2*nRows-2;
}
}
else if(j==nRows){
i=nRows;
while(i-1<s.length()){
r+=s[i-1];
i+=2*nRows-2;
}
}
else{
i=j;
while(i-1<s.length()){
r+=s[i-1];
i+=nRows-1;
}
}
}
return r;
}
};
```