+ 3

test yourself

Distancia al siguiente capicĂșa Tiempo mĂĄximo: 2,000-3,000 s Memoria mĂĄxima: 4096 KiB Los nĂșmeros capicĂșa son aquellos que, tras ser escritos, se leen igual de izquierda a derecha que de derecha a izquierda. Por ejemplo, los nĂșmeros 11, 474 o 9.889 son capicĂșa. Como ocurre con los nĂșmeros primos, entre los nĂșmeros bajos hay muchos nĂșmeros capicĂșa. Los primeros son el 0, 1, 2, 
, 9, que estĂĄn todos a distancia 1. MĂĄs adelante llegan el 11, 22, 33, 
, 99 que estĂĄn a distancia 11. El siguiente, sin embargo, vuelve a estar cerca: el 101 estĂĄ sĂłlo a distancia 2 del anterior. ÂżEres capaz de saber a quĂ© distancia estĂĄ el siguiente capicĂșa de un nĂșmero dado? Entrada La entrada comienza con una lĂ­nea indicando el nĂșmero de casos de prueba que vienen a continuaciĂłn. Cada caso de prueba es un nĂșmero mayor o igual que 0 y menor o igual que 2.000.000.000. Salida Para cada caso de prueba se indicarĂĄ la distancia del nĂșmero al siguiente capicĂșa. Ten en cuenta que si el nĂșmero leĂ­do resulta ser capicĂșa Ă©l mismo, habrĂĄ que indicar la distancia al siguiente. Entrada de ejemplo 3 8 27 179 Salida de ejemplo 1 6 2

3rd Jun 2017, 12:21 AM
Julio Cesar Rosales Rodriguez
Julio Cesar Rosales Rodriguez - avatar
5 Answers
+ 1
Here is my solution to the problem: https://code.sololearn.com/cyG2BDGoywVW/?ref=app
3rd Jun 2017, 1:55 AM
Ulisses Cruz
Ulisses Cruz - avatar
0
sorry it is in spanish
3rd Jun 2017, 12:33 AM
Julio Cesar Rosales Rodriguez
Julio Cesar Rosales Rodriguez - avatar
0
Translation: Test yourself (Posted By Julio Cesar Rosales Rodriguez) Distance to next palindrome Maximum time: 2,000-3,000s Maximum memory: 4096 KiB The palindrome numbers are those that, after being written, are read equally from left to right than from right to left. For example, numbers 11, 474 or 9,889 are palindrome. As with prime numbers, among the low numbers there are many palindrome numbers. The first ones are 0, 1, 2, ..., 9, which are all at a distance 1 Further on, 11, 22, 33, ..., 99 arrive at a distance 11. The next, however, : 101 is only 2 away from the previous one. Are you able to know how far is the next palindrome from a given number? Input: The input begins with a line indicating the number of test cases that follow. Each test case is a number greater than or equal to 0 and less than or equal to 2,000,000,000. Output: For each test case the distance from the number to the next palindrom will be indicated. Keep in mind that if the number you read turns out to be palindrome itself, you must indicate the distance to the next one. Example input: 3 8 27 179 Example Output: 1 6 2
3rd Jun 2017, 2:30 AM
Ulisses Cruz
Ulisses Cruz - avatar