标签:and https har continue ems public for `` class
c++
```
class Solution {
public:
string a[31];
string countAndSay(int n) {
a[1]="1";
for(int i=2;i<=30;i++)
{
char s1=a[i-1][0];int num=1;
string str="";
for(int j=1;j<a[i-1].size();j++)
{
if(a[i-1][j]!=a[i-1][j-1])
{
char x = num+'0';
str+=x;
str+=s1;
num=1;
s1=a[i-1][j];
continue;
}
else
num++;
}
char x = num+'0';
str += x;
str += s1;
a[i]=str;
}
return a[n];
}
};
``
标签:and https har continue ems public for `` class
原文地址:https://www.cnblogs.com/dacc123/p/11294544.html