HOUSE1 - PETERHOUSE

no tags 

Problem (English version) - Problema (versión en Español)

Peter lives in a street where the house numbers are 1, 2, 3, etc.. The sum of the house numbers lower than the number of the Peter's house is equal to the sum of the numbers of greater houses. The number of his house has N digits.

Peter forgot his house number and he need our help with a program to find out what it is and at the same time determine the number of houses that are on the street.

Can you tell Peter his house number and the number of houses in his street?

Pedro vive en una calle en la cual los números de las casas son 1, 2, 3, etc. La suma de los números de las casas menores que el número de la casa de Pedro, es igual a la suma de los números de las casas mayores. El número de su casa posee N cifras.

Pedro olvidó el número de su casa y debe hacer un cálculo para saber cuál es y al mismo tiempo determinar el número de casas que hay en la calle.

Podemos decirle a Pedro cuál es el número de su casa y la cantidad de casas en la calle?

Input - Entrada

The input is one line with an integer N, 1 <= N <= 5, which indicates the number of digits that have the number of the Peter's house.

La entrada es una línea con un entero N, 1 <= N <= 5, que indica la cantidad de dígitos que tiene el número de la casa de Pedro.

Output - Salida

As output your program must show a line with two integers, the first is the number of the Peter's house, and the second is the number of houses in the street of Peter's house.

Como salida debe mostrarse una línea con 2 enteros, el primero es el número de la casa de Pedro, y el segundo la cantidad de casas en la calle de la casa de Pedro.

Example - Ejemplo

Input - Entrada:
2

Output - Salida:
35 49

hide comments
backer01: 2022-06-17 22:48:21

I have solution O(10^n), not O((10^n)^2). Any faster solutions, excluding precalc?


Added by:Coach UTN FRSF
Date:2013-06-22
Time limit:1s-10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:If anyone knows the author, please tell me!