[Plain]
/* Start the comments in the program header (to avoid any problems encountered during the submission of blog posts, the slash used to indicate that the comments have been deleted)
* Copyright and version Declaration of the program
* All rights reserved.
* File name: txt. c
* Author: liuyongshui
* Question: how many times can an array appear in a small to large array be obtained?
* Completion date: January 1, April 24, 2013
* Version No.: V1.0
*/
# Include <stdio. h>
Int main ()
{
Int I;
Int k;
Int max = 0;
Int j = 0;
Int cout = 0;
Int re_num [] = {1, 2, 2, 3, 3, 3, 4, 5, 5, 6}; // start data
Int num [10]; // No duplicate data
Num [0] = re_num [0];
For (I = 0; I <10; I ++) // This loop places different data into num []
{
If (num [j]! = Re_num [I])
{
Num [++ j] = re_num [I];
}
}
For (I = 0; I <j; I ++) // calculate the longest data
{
Cout = 0;
For (k = 0; k <10; k ++)
{
If (num [I] = re_num [k])
{
Cout ++;
}
If (max <cout) // put the longest cout calculation into max
{
Max = cout;
}
}
}
Printf ("the maximum number of repetitions in this array is % d \ n", max );
Return 0;
}
/* Start the comments in the program header (to avoid any problems encountered during the submission of blog posts, the slash used to indicate that the comments have been deleted)
* Copyright and version Declaration of the program
* All rights reserved.
* File name: txt. c
* Author: liuyongshui
* Question: how many times can an array appear in a small to large array be obtained?
* Completion date: January 1, April 24, 2013
* Version No.: V1.0
*/
# Include <stdio. h>
Int main ()
{
Int I;
Int k;
Int max = 0;
Int j = 0;
Int cout = 0;
Int re_num [] = {1, 2, 2, 3, 3, 3, 4, 5, 5, 6}; // start data
Int num [10]; // No duplicate data
Num [0] = re_num [0];
For (I = 0; I <10; I ++) // This loop places different data into num []
{
If (num [j]! = Re_num [I])
{
Num [++ j] = re_num [I];
}
}
For (I = 0; I <j; I ++) // calculate the longest data
{
Cout = 0;
For (k = 0; k <10; k ++)
{
If (num [I] = re_num [k])
{
Cout ++;
}
If (max <cout) // put the longest cout calculation into max
{
Max = cout;
}
}
}
Printf ("the maximum number of repetitions in this array is % d \ n", max );
Return 0;
}