Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int x;
- int b;
- int a[10]; // объявляем массив
- for(int i = 0; i < 10; ++i) {
- a[i] = 0; // иннициализируем счетчики
- }
- for(int i = 0; i < n; ++i) {
- cin >> x;
- while (x >= 0) {
- b = x % 10;
- ++a[b];
- x /= 10;
- }
- }
- b = -1;
- int num = 0;
- for(int i = 0; i < 10; ++i) {
- if(a[i] >= b) {
- b = a[i];
- num = i;
- }
- }
- cout << num << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement