miércoles, 26 de abril de 2017

ejercicios de programacion competitiva



Highest and Position

Adapted by Neilor Tonin, URI Brazil
Timelimit: 1

Leer 10 números enteros. Imprima el valor de lectura más alto y la posición de entrada.
Entrada
El archivo de entrada contiene 10 números enteros positivos diferentes.
Salida
Imprima el número más alto leído y la posición de entrada de este valor, de acuerdo con el ejemplo dado.

EJEMPLOS DE ENTRADA
2
113
45
34565
6
1

1
12
8
7
 

EJEMPLOS DE SALIDA 

34565
4

EJERCICIO 2

Perfect Number

Adapted by Neilor Tonin, URI Brazil
Timelimit: 1
In mathematics, a perfect number is an integer for which the sum of all its own positive divisors (excluding itself) is equal to the number itself. For example the number 6 is perfect, because 1+2+3 is equal to 6. Your task is to write a program that read integer numbers and print a message informing if these numbers are perfect or are not perfect.

Input

The input contains several test cases. The first contains the number of test cases N (1 ≤ N ≤ 100). Each one of the following N lines contains an integer X (1 ≤ X ≤ 108), that can be or not a perfect number.

Output

For each test case print the message “X eh perfeito” (X is perfect) or “X nao eh perfeito” (X isn't perfect) according with to above specification.
Input Sample Output Sample
3
6
5
28
6 eh perfeito
5 nao eh perfeito
28 eh perfeito

No hay comentarios:

Publicar un comentario