- Mensajes
- 8.048
- Reacciones
- 840
- Puntos
- 1.476
Pon a prueba tu ingenio. Reta a tu mente
Este es un tema en el que cualquier usuario puede participar.
Intentaré poner varios tipos de problemas para que sean resueltos. Como la mayor parte de la programación, los pondré en inglés, porque ese es su idioma original, pero si alguien no le entiende postea y le pongo que se tiene que hacer en español.
La mayoría de las personas dicen que por esto se tiene que empezar a programar y es en gran parte la realidad porque mejorará tus técnicas de programación. El problema es que no a todo mundo le gusta pensar, es más... es mayoría las que buscan todo más fácil.
Explicaré un poco antes de empezar:
En matemáticas, ciencias de la computación y disciplinas relacionadas, un algoritmo es un conjunto preescrito de instrucciones o reglas bien definidas, ordenadas y finitas que permite realizar una actividad mediante pasos sucesivos que no generen dudas a quien deba realizar dicha actividad. Dados un estado inicial y una entrada, siguiendo los pasos sucesivos se llega a un estado final y se obtiene una solución. Los algoritmos son el objeto de estudio de la algoritmia.
Pondré varios tipos de algoritmos y cuando sean resueltos (y estén bien) iré poniendo otros del mismo tipo; si no se resuelven en 5 días yo pondré la solución explicando cada cosa. Por ahora pondré lo siguiente
- Algoritmos sencillos para los que empiezan a programar
- Algoritmos matemáticos para aquellos que les gusta pensar pero no les interesa saber programar
- Algoritmos lógicos, que sería lo mismo que para el de arriba. (No prometo poner muchos ya que es difícil encontrarlos)
- Algoritmos difíciles. Buscan un reto? Aquí lo encontrarán. No es necesario saber programar de manera perfecta, pero sí requiere que sepan lo básico que pueden hacer con un programa y que tengan muy buena lógica.
Para los que sepan programar, copien y peguen su código, no es necesario que digan paso por paso lo que hacen.
Para los que no saben programar, expliquen los pasos, es decir... si van a resolver uno matemático digan por ejemplo:
Con la altura que nos da el problema la dividimos entre 3, la multiplicamos por la base y... blablabla así hasta llegar al resultado porque para comprobarlo tengo que pasarlo a código
Ahora explicaré cómo estarán los problemas (o la mayoría, porque recuerden, no son míos, están en páginas que tienen su propio "calificador")
Base de problemas:
Título
Descripción
<Aquí vendrá el problema en sí, lo que se tiene que hacer>
Especificación de entrada
<Aquí vendrán todos los datos que se tengan de lo que recibirá el programa, por ejemplo, el tamaño de los números>
Especificación de salida
<Aquí por lo general vendrá el formato en el que se tienen que imprimir los resultados>
Ejemplo de entrada
Datos como se los dará el programa, pueden usarlo como el ejemplo de prueba para ver si su programa funciona bien
Ejemplo de salida
El resultado que debería de dar un programa (bien hecho) con el ejemplo de entrada anterior.
Descripción
<Aquí vendrá el problema en sí, lo que se tiene que hacer>
Especificación de entrada
<Aquí vendrán todos los datos que se tengan de lo que recibirá el programa, por ejemplo, el tamaño de los números>
Especificación de salida
<Aquí por lo general vendrá el formato en el que se tienen que imprimir los resultados>
Ejemplo de entrada
Datos como se los dará el programa, pueden usarlo como el ejemplo de prueba para ver si su programa funciona bien
Ejemplo de salida
El resultado que debería de dar un programa (bien hecho) con el ejemplo de entrada anterior.
Fase 1:
Problema básico
Matemático
Difícil
A+B Problem
Description
Calculate A + B.
Input Specification
Two integer A,B (0 <= A,B <= 10).
Output Specification
Output A + B.
Sample Input
1 2
Sample Output
3
Description
Calculate A + B.
Input Specification
Two integer A,B (0 <= A,B <= 10).
Output Specification
Output A + B.
Sample Input
1 2
Sample Output
3
Matemático
Sum
Description
Your task is to find the sum of all integer numbers lying between 1 and N inclusive.
Input Specification
The input consists of a single integer N that is not greater than 10000 by it's absolute value.
Output Specification
Write to the output a single integer number that is the sum of all integer numbers lying between 1 and N inclusive.
Sample Input
3
Sample Output
6
Description
Your task is to find the sum of all integer numbers lying between 1 and N inclusive.
Input Specification
The input consists of a single integer N that is not greater than 10000 by it's absolute value.
Output Specification
Write to the output a single integer number that is the sum of all integer numbers lying between 1 and N inclusive.
Sample Input
3
Sample Output
6
Difícil
Empezaremos con algo sencillo, sólo para demostrar que saben programar
General Election
Description
General Election is over, now it is time to count the votes! There are n (2 <= n <= 5) candidates and m (1 <= m <= 100) vote regions. Given the number of votes for each candidate from each region, determine which candidate is the winner (one with the most votes).
Input Specification
The first line of input contains an integer T, the number of test cases follow.
Each test case starts with an integer n and m denoting the number of candidate and number of region. The next m lines each contains n integers, V1, V2, ..., Vn (0 <= Vi <= 1000) the number of votes for candidate i.
Output Specification
For each test case, output in a line the winning candidate. You may safely assume that the winner is unique.
Sample Input
2
3 3
159 213 450
512 890 993
215 420 397
2 5
40 64
35 12
102 58
43 15
79 41
Sample Output
3
1
General Election
Description
General Election is over, now it is time to count the votes! There are n (2 <= n <= 5) candidates and m (1 <= m <= 100) vote regions. Given the number of votes for each candidate from each region, determine which candidate is the winner (one with the most votes).
Input Specification
The first line of input contains an integer T, the number of test cases follow.
Each test case starts with an integer n and m denoting the number of candidate and number of region. The next m lines each contains n integers, V1, V2, ..., Vn (0 <= Vi <= 1000) the number of votes for candidate i.
Output Specification
For each test case, output in a line the winning candidate. You may safely assume that the winner is unique.
Sample Input
2
3 3
159 213 450
512 890 993
215 420 397
2 5
40 64
35 12
102 58
43 15
79 41
Sample Output
3
1
Fase 2:
Básico
Matemático
Lógico
Bijele
Description
Mirko has found an old chessboard and a set of pieces in his attic. Unfortunately, the set contains only white pieces, and apparently an incorrect number of them. A set of pieces should contain:
· One king
· One queen
· Two rooks
· Two bishops
· Two knights
· Eight pawns
Mirko would like to know how many pieces of each type he should add or remove to make a valid set.
Input Specification
The first line contain a number n, is the number of test cases. The input consists of 6 integers on a single line, each between 0 and 10 (inclusive). The numbers are, in order, the numbers of kings, queens, rooks, bishops, knights and pawns in the set Mirko found.
Output Specification
Output should consist of 6 integers on a single line; the number of pieces of each type Mirko should add or remove. If a number is positive, Mirko needs to add that many pieces. If a number is negative, Mirko needs to remove pieces.
Sample Input
2
0 1 2 2 2 7
2 1 2 1 2 1
Sample Output
1 0 0 0 0 1
-1 0 0 1 0 7
Description
Mirko has found an old chessboard and a set of pieces in his attic. Unfortunately, the set contains only white pieces, and apparently an incorrect number of them. A set of pieces should contain:
· One king
· One queen
· Two rooks
· Two bishops
· Two knights
· Eight pawns
Mirko would like to know how many pieces of each type he should add or remove to make a valid set.
Input Specification
The first line contain a number n, is the number of test cases. The input consists of 6 integers on a single line, each between 0 and 10 (inclusive). The numbers are, in order, the numbers of kings, queens, rooks, bishops, knights and pawns in the set Mirko found.
Output Specification
Output should consist of 6 integers on a single line; the number of pieces of each type Mirko should add or remove. If a number is positive, Mirko needs to add that many pieces. If a number is negative, Mirko needs to remove pieces.
Sample Input
2
0 1 2 2 2 7
2 1 2 1 2 1
Sample Output
1 0 0 0 0 1
-1 0 0 1 0 7
Matemático
Ternary
Description
You will be given a decimal number. You will have to convert it to its ternary (Base 3) equivalent.
Input Specification
The input file contains at most 100 lines of inputs. Each line contains a non-negative decimal integer N(N < 1000000001). Input is terminated by a line containing a negative value. This line should not be processed.
Output Specification
For each line of input produce one line of output. This line contains the ternary equivalent of decimal value N.
Sample Input
10
100
1000
-1
Sample Output
101
10201
1101001
Description
You will be given a decimal number. You will have to convert it to its ternary (Base 3) equivalent.
Input Specification
The input file contains at most 100 lines of inputs. Each line contains a non-negative decimal integer N(N < 1000000001). Input is terminated by a line containing a negative value. This line should not be processed.
Output Specification
For each line of input produce one line of output. This line contains the ternary equivalent of decimal value N.
Sample Input
10
100
1000
-1
Sample Output
101
10201
1101001
Lógico
Bee
Description
In Africa there is a very special species of bee. Every year, the female bees of such species give birth to one male bee, while the male bees give birth to one male bee and one female bee, and then they die! Now scientists have accidentally found one "magical female bee" of such special species to the effect that she is immortal, but still able to give birth once a year as all the other female bees. The scientists would like to know how many bees there will be after N years. Please write a program that helps them find the number of male bees and the total number of all bees after N years.
Input Specification
Each line of input contains an integer N (N ≥ 0). Input ends with a case where N = -1 (this case should NOT be processed).
Output Specification
Each line of output should have two numbers, the first one being the number of male bees after N years, and the second one being the total number of bees after N years. The two numbers will not exceed 232.
Sample Input
1
3
-1
Sample Output
1 2
4 7
Description
In Africa there is a very special species of bee. Every year, the female bees of such species give birth to one male bee, while the male bees give birth to one male bee and one female bee, and then they die! Now scientists have accidentally found one "magical female bee" of such special species to the effect that she is immortal, but still able to give birth once a year as all the other female bees. The scientists would like to know how many bees there will be after N years. Please write a program that helps them find the number of male bees and the total number of all bees after N years.
Input Specification
Each line of input contains an integer N (N ≥ 0). Input ends with a case where N = -1 (this case should NOT be processed).
Output Specification
Each line of output should have two numbers, the first one being the number of male bees after N years, and the second one being the total number of bees after N years. The two numbers will not exceed 232.
Sample Input
1
3
-1
Sample Output
1 2
4 7
Extras:
Aquí pondré extras por si alguna vez hacen muy rápido todos los problemas.
No pondré las respuestas en el segundo post y sólo le avisaré que está bien al que lo conteste, si está mal también le diré más o menos cómo puede corregirlo. No se dejen llevar por la "simpleza" de los problemas.
1.
No pondré las respuestas en el segundo post y sólo le avisaré que está bien al que lo conteste, si está mal también le diré más o menos cómo puede corregirlo. No se dejen llevar por la "simpleza" de los problemas.
1.
Uno de los problemas básicos para alguien que hace algoritmos es pensar en cómo calcular los números primos (números que sólo se pueden dividir entre el 1 y ellos mismos), este añade un nuevo reto.
Prime Generator
Description
Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!
Input Specification
The input begins with the number t of test cases in a single line (t <= 10).
In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, n-m <= 100000) separated by a space.
Output Specification
For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.
Sample Input
2
1 10
3 5
Sample Output
2
3
5
7
3
5
Prime Generator
Description
Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!
Input Specification
The input begins with the number t of test cases in a single line (t <= 10).
In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, n-m <= 100000) separated by a space.
Output Specification
For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.
Sample Input
2
1 10
3 5
Sample Output
2
3
5
7
3
5
Nota importante: Recuerden que los algoritmos se resuelven para cualquier caso no sólo el de prueba, es decir... en el programa viene por ejemplo que la suma de 2+3=5 pero ustedes deben hacer el programa para resolver cualquier caso (excepto en los que indiquen que es específico, cosa que normalmente pasa únicamente en los matemáticos).
Última edición por un moderador: