Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int lenght = 0;
- cin >> lenght;
- const int len = lenght;
- int counter0 = 0;
- int counter1 = 0;
- int counter2 = 0;
- int counter3 = 0;
- int counter4 = 0;
- int counter5 = 0;
- int counter6 = 0;
- int counter7 = 0;
- int counter8 = 0;
- int counter9 = 0;
- int etalonArr[10] = {0,1,2,3,4,5,6,7,8,9};
- int newArr[10];
- int arr[len] = {};
- int maxValue = INT_MIN;
- for(int i = 0; i < lenght; i ++){
- cin >> arr[i];
- }
- for(int k = 0; k < lenght; k ++){
- if(arr[k] == 0){
- counter0++;
- }
- if(arr[k] == 1){
- counter1++;
- }
- if(arr[k] == 2){
- counter2++;
- }
- if(arr[k] == 3){
- counter3++;
- }
- if(arr[k] == 4){
- counter4++;
- }
- if(arr[k] == 5){
- counter5++;
- }
- if(arr[k] == 6){
- counter6++;
- }
- if(arr[k] == 7){
- counter7++;
- }
- if(arr[k] == 8){
- counter8++;
- }
- if(arr[k] == 9){
- counter9++;
- }
- }
- newArr[0] = counter0;
- newArr[1] = counter1;
- newArr[2] = counter2;
- newArr[3] = counter3;
- newArr[4] = counter4;
- newArr[5] = counter5;
- newArr[6] = counter6;
- newArr[7] = counter7;
- newArr[8] = counter8;
- newArr[9] = counter9;
- // for(int d = 0; d < 10; d ++){
- // cout << newArr[d] << " ";
- // }
- for(int d = 0; d < 10; d ++){
- if(newArr[d] > maxValue){
- maxValue = newArr[d];
- }
- }
- // cout << endl;
- // cout << maxValue;
- // cout << endl;
- for(int y = 0; y < 10; y ++){
- if(newArr[y] == maxValue){
- cout << etalonArr[y] << " ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement