Want to see all of this problem
CodePudding user response:
If n<30, and don't have much data, I think that there is nothing wrong with writing,CodePudding user response:
Code no problemBut don't have to every time the temp copy to the result, can use the array, used interchangeably
int main () {
Char a [2] [6000];//2 line (current and previous line)
Int n, I, j, k, m;
While (the scanf (" % d ", & amp; N) n==1) {//input (input end of the digital loop)
Strcpy (a [0], "1");//initialize the first line
For (I=1; iFor (j=1, k=0, m=1; A [(I - 1) % 2] [1].='\ 0'; J++) {//so you can line parity used interchangeably
If (a [(I - 1) % 2] [j]==a/(I - 1) % 2 [1]) {//in front of the number and position of the same number
m++;//the statistical occurrences
} else {//or
A [k++] [I % 2]=m + '0'.//record number
A [k++] [I % 2]=[(I - 1) % 2] a [j - 1);//record number
M=1;//initialization statistical number
}
}
A [k] [I % 2]='\ 0';
}
//print the results
Printf (" \ "% s \ " n ", a [(n - 1) % 2]).
}
return 0;
}