Просто новость
int main(int argc, char* argv[]){ unsigned int mas[]={1,2,3,4,5,6,7,8,9,10,11,12,101,102,103,201,202,203,301,302,303,501,502,503,505,601,602}; unsigned int count=sizeof(mas)/sizeof(mas[0]); unsigned int max[30]={0,}; unsigned int temp_max=0; unsigned int i=0; unsigned int j; unsigned int sot; for (j=0;j<count;j++) { sot=(i+1)*100; if (mas[j]>sot) { max[i]=temp_max; i++; temp_max=mas[j]; } else { if (mas[j]>temp_max) temp_max=mas[j]; } } max[i]=temp_max; for (j=0;j<30;j++) if (max[j]) cout << max[j] << " "; cout << endl; system("pause"); return 0;}
Как-то так:Код: [Выделить]int main(int argc, char* argv[]){ unsigned int mas[]={1,2,3,4,5,6,7,8,9,10,11,12,101,102,103,201,202,203,301,302,303,501,502,503,505,601,602}; unsigned int count=sizeof(mas)/sizeof(mas[0]); unsigned int max[30]={0,}; unsigned int temp_max=0; unsigned int i=0; unsigned int j; unsigned int sot; for (j=0;j<count;j++) { sot=(i+1)*100; if (mas[j]>sot) { max[i]=temp_max; i++; temp_max=mas[j]; } else { if (mas[j]>temp_max) temp_max=mas[j]; } } max[i]=temp_max; for (j=0;j<30;j++) if (max[j]) cout << max[j] << " "; cout << endl; system("pause"); return 0;}Пример можно упростить, если числа в массиве действительно будут упорядочены по возрастанию =)