// Pooh.cpp : Defines the entry point for the console application. // #include #include #include using namespace std; int main() { ifstream in("pooh.in"); ofstream out("pooh.out"); map arr; int N; in>>N; int key; for ( int i = 0 ; i < N ; i ++ ) { in>>key; if ( arr.count(key) != 0 ){ arr[key]++; } else { arr[key] = 1; } } int max = -1; int cnt = 5001; int buckle = 0; for ( map::iterator it = arr.begin(); it != arr.end() ; it++ ) { if ( max < it->first * it->second ) { max = it->first * it->second; cnt = it->second; buckle = it->first; } if ( max == it->first * it->second && cnt > it->second ){ max = it->first * it->second; cnt = it->second; buckle = it->first; } } out<