Posició i valor del nombre més gran


Submit solution

Points: 10
Time limit: 5.0s
Memory limit: 256M

Author:
Problem types
Allowed languages
C#, Go, Java

Escriu un programa que, donada una llista de \(Nt\) nombres enters \(Ni\) que no es repeteixen, retorni el valor del nombre més gran junt amb la seva posició.

Input Format

Primera línia:

  • \(Nt\): quantitat de nombres que es rebràn.

Segona línia:

  • Els nombres \(Ni\) separats per un espai.

Constraints

  • \(Nt > 0\)
  • \(Ni\) i \(Nt\): són nombres enters.

Output Format

S'imprimirà el següent text per pantalla: El nombre més gran és el Ng i es troba a la posició P.

Tenint en compte que:

  • \(Ng\): serà el nombre més gran.
  • \(P\): serà la posició del nombre més gran.

Sample Input 0

10
1 2 3 4 5 6 7 8 9 10

Sample Output 0

El nombre més gran és el 10 i es troba a la posició 10

Sample Input 1

10
10 9 8 7 6 5 4 3 2 1

Sample Output 1

El nombre més gran és el 10 i es troba a la posició 1

Sample Input 2

5
-1 -2 -3 -4 -5

Sample Output 2

El nombre més gran és el -1 i es troba a la posició 1

Sample Input 3

5
-5 -4 -3 -2 -1

Sample Output 3

El nombre més gran és el -1 i es troba a la posició 5

Sample Input 4

5
-9 7 0 -15 2

Sample Output 4

El nombre més gran és el 7 i es troba a la posició 2

Sample Input 5

1
0

Sample Output 5

El nombre més gran és el 0 i es troba a la posició 1
CC BY-NC-SA 4.0