Buenas! Hoy ha empezado el concurso de programación de tuenti. Alguien de por aquí está apuntado?
Voy poniendo los retos del concurso
Challenge 1: Super Hard Sum
El programa debe leer todos los numeros de una linea, con los espacios que quieras entre ellos, y pudiendo ser negativos y muy grandes, y debe devolver la suma en la siguiente linea.
Sample input
2 3
4 5 1
Sample output
5
10
Challenge 2: TLang
El enunciado decia algo asi de que en tuenti a veces necesitan desarrollar sus propios lenguajes y que te ponen de ejemplo uno y tienes q interpretarlo.
Sample input
^= 1 2$
^# 2 2$
^@3 1$
Sample output
3
4
2
Challenge 3: Emirps
What is the sum of all emirps up to X?
Sample input
100
200
Sample output
418
1489
Challenge 4: Task Duration
You are trying to solve a very complex problem. In order to simplify it, you have divided it into many sub tasks. Most of these sub-tasks can be run in parallel, but some are dependent on the previous resolution of other tasks. There is no limit on the number of tasks that can be run in parallel. Each task has an associated computation time.
You are be given a subset of these tasks. For each of them you need to specify what is the minimal computation time for resolving the task (you must consider task dependencies).
The relations between the tasks are represented in the file contained in this archive: in.zip.This file is in the following format:
#Number of tasks
n
#Task duration <- task x has an associated computation time of tx
x,tx
#Task dependencies <- the resolution of task x depends of previously solving tasks y,z,w
x,y,z,w
It is imposible for two different tasks to be dependent on the resolution of one common task:
#Task dependencies <- this is not valid
x,y
z,y
The expected output is the following format: taskId taskComputationTime
x tx
y ty
z tz
From the standard input you will receive a set of tasks for which to compute the total time in the following format:
x,y,z
Sample input file
#Number of tasks
6
#Task duration
0,2
1,3
2,4
3,9
4,7
5,9
#Task dependencies
0,4
3,0,1,2
4,5
Sample standard input for tasks to compute time
3,1,4
Sample output
3 27
1 3
4 16