Dígit més freqüent P94464


Statement
 

pdf   zip

html

Donada una base b i una seqüència de naturals, calculeu quin és el dígit que apareix més freqüentment en la representació dels nombres en base b.

Entrada

L’entrada consisteix en una b entre 2 i 10 seguida de diversos naturals entre 0 i 109.

Sortida

Escriviu el dígit més frequent i el nombre de vegades que apareix. En cas d’empat, trieu el dígit més petit.

Public test cases
  • Input

    10
    12 34 56 78 76 34 7777777 34 26
    

    Output

    7 9
    
  • Input

    2
    6 7 12 2 1
    

    Output

    1 9
    
  • Input

    4
    

    Output

    0 0
    
  • Input

    10
    999 0 0 0
    

    Output

    0 3
    
  • Information
    Author
    Jordi Cortadella
    Language
    Catalan
    Other languages
    Spanish
    Official solutions
    C++ Python
    User solutions
    C++ Python