ATUDA A HACER ESTE PROGRAMA EN C++

#1
OLA NECESITO QUE ALGUIEN DE USTEDES ME PUEDA AYUDAR HACER ESTE PROGRAMA!!!:chommy::chommy:

1846. [SIZE=+2]Teseo y el Minotauro[/SIZE]

Time Limit: 1.0 Seconds Memory Limit: 65536K​
Plazo: 1,0 segundos límite de memoria: 65536K

Total Runs: 20 Accepted Runs: 3​
Total de Pistas: 20 Pistas aceptadas: 3



Those of you with a classical education may remember the legend of Theseus and the Minotaur.​


Aquellos de ustedes con una educación clásica puede recordar la leyenda de Teseo y el Minotauro.
This is an unlikely tale involving a bull-headed monster, lovelorn damsels, balls of silk and an underground maze full of twisty little passages all alike.​




Esta es una historia poco probable participación de un toro monstruo con cabeza, doncellas enamorado, bolas de seda y un laberinto subterráneo lleno de curvas pasajes poco todos por igual.
In line with the educational nature of this contest, we will now reveal the true story.​


En consonancia con el carácter educativo de este concurso, ahora vamos a revelar la verdadera historia.


The maze was a series of caverns connected by passages.​


El laberinto es una serie de cavernas conectadas por pasajes.
Theseus managed to smuggle into the labyrinth with him a supply of candles and a small tube of phosphorescent paint with which he could mark his way, or, more specifically, the exits he used.​




Teseo logrado introducir de contrabando en el laberinto con él una fuente de velas y un pequeño tubo de pintura fosforescente con el que podría marcar el camino, o, más específicamente, las salidas que ha utilizado.
He knew that he would be lowered into a passage between two caverns, and that if he could find and kill the Minotaur he would be set free.​




Sabía que iba a ser bajado en un pasaje entre dos cavernas, y que si podía encontrar y matar al Minotauro que sería puesto en libertad.
His intended strategy was to move cautiously along a passage until he came to a cavern and then turn right (he was left-handed and wished to keep his sword away from the wall) and feel his way around the edge of the cavern until he came to an exit.​




Su estrategia estaba destinada a avanzar con cautela por un pasillo hasta llegar a una caverna y luego girar a la derecha (fue dejado de mano y desea mantener la espada de la pared) y siente a su manera alrededor del borde de la caverna, hasta que llegó a una salida.
If this was unmarked, he would mark it and enter it; if it was marked he would ignore it and continue around the cavern.​




Si este no estaba marcado, le marca y entrar en él, si él estuvo marcado ignorarlo y continuar alrededor de la caverna.
If he heard the Minotaur in a cavern with him, he would light a candle and kill the Minotaur, since the Minotaur would be blinded by the light. If, however, he met the Minotaur in a passage he would be in trouble, since the size of the passage would restrict his movements and he would be unable to either light a candle or fight adequately.​




Si oyó el Minotauro, en una caverna con él, se enciende una vela y matar al Minotauro, ya que el Minotauro se cegado por la luz. Si, en cambio, se encontró con el Minotauro, en un pasaje que estaría en problemas, ya que el tamaño del paso a limitar sus movimientos y que no podría ni encender una vela o luchar de manera adecuada.
When he entered a cavern that had been previously entered by the Minotaur he would light a candle and leave it there and then turn right (as usual) but take the Minotaur's exit ignoring all his previous marks.​


Cuando entró en una caverna que había sido introducido previamente por el Minotauro que encender una vela y dejarla allí, y luego a la derecha (como siempre), pero tomar la salida el Minotauro, ignorando todas sus marcas anteriores.

In the meantime, the Minotaur was also searching for Theseus.​


Mientras tanto, el Minotauro es también la búsqueda de Teseo.
He was bigger and slower-moving but he knew the caverns well and hence, unlikely as it may seem, every time he emerged from a passage into a cavern, so did Theseus, albeit usually in a different one.​




Era más grande y más lento, pero sabía de las cavernas, así y por lo tanto, es poco probable que pueda parecer, cada vez que salía de un pasaje en una caverna, también lo hizo Teseo, aunque por lo general en uno diferente.
The Minotaur turned left when he entered a cavern and traveled clockwise around it until he came to an unmarked (by him) exit, at which point he would mark it and take it.​




El Minotauro giró a la izquierda cuando entró en una caverna y viajó alrededor de las agujas del reloj hasta que llegó a un marcado (por él) la salida, momento en el que se marca y tomarlo.
If he sensed that the cavern he was about to enter had a candle burning in it, he would turn and flee back up the passage he had just used, arriving back at the previous cavern to complete his 'turn.'​


Si la sensación de que la caverna estaba a punto de entrar había una vela encendida en él, a su vez, y huir de nuevo hasta el paso que acababa de usar, regresando a la cueva anterior para completar su "turno".

Consider the following labyrinth as an example​
Considere el laberinto siguiente como un ejemplo


Assume that Theseus starts off between A and C going toward C, and that the Minotaur starts off between F and H going toward H. After entering C, Theseus will move to D, whereas the Minotaur, after entering H will move to G. Theseus will then move towards G while the Minotaur will head for D and Theseus will be killed in the corridor between D and G. If, however, Theseus starts off as before and the Minotaur starts off between D and G then, while Theseus moves from C to D to G, the Minotaur moves from G to E to F. When Theseus enters G he detects that the Minotaur has been there before him and heads for E, and not for H, reaching it as the Minotaur reaches H. The Minotaur is thwarted in his attempt to get to G and turns back, arriving in H just as Theseus, still 'following' the Minotaur arrives in F. The Minotaur tries E and is again thwarted and arrives back at H just as Theseus arrives in hot pursuit.​


Suponga que Teseo comienza entre A y C van hacia C, y que el Minotauro comienza entre F y H va hacia H. Después de entrar en C, Teseo se moverá a D, mientras que el Minotauro, después de entrar en H se trasladará a G. Teseo luego se mueve hacia G, mientras que el Minotauro se dirigirá a D y Teseo será asesinado en el corredor entre D y G. Sin embargo, si comienza como Teseo y el Minotauro antes de que comienza entre D y G, entonces, mientras se mueve Teseo de C a D a la G, se mueve el Minotauro de G a E de la F. Cuando Teseo entra G se detecta que el Minotauro ha estado allí antes que él y los jefes de E, y no para H, alcanzando como el Minotauro alcanza H. El Minotauro es frustrado en su intento de llegar a G y da la vuelta, para llegar a H como Teseo, el todavía 'siguiente' Minotauro llega a F. El Minotauro intenta E, y es de nuevo frustradas y llega de vuelta en H como Teseo llega a la persecución.
Thus the Minotaur is slain in H.​


Así, el Minotauro es asesinado en el H.

Write a program that will simulate Theseus' pursuit of the Minotaur.​
Escriba un programa que simule la búsqueda de Teseo del Minotauro.

Input
Entrada

Input will consist of a series of labyrinths.​


De entrada consistirá de una serie de laberintos.
Each labyrinth will contain a series of cavern descriptors, one per line. Each line will contain a cavern identifier (a single upper case character) followed by a colon :)) and a list of caverns reachable from it (in counterclockwise order).​




Cada laberinto contendrá una serie de descriptores caverna, uno por línea. Cada línea tendrá un identificador caverna (un solo carácter en mayúsculas), seguido por dos puntos :)) y una lista de las cavernas accesible desde ella (en orden de izquierda).
No cavern will be connected to itself.​




N caverna se conectará a sí mismo.
The cavern descriptors will not be ordered in any way.​




Los descriptores de la caverna no se ordenó ninguna manera.
The description of a labyrinth will be terminated by a line starting with a @ character, followed by two pairs of cavern identifiers.​




La descripción de un laberinto se dará por terminado por una línea que comienza con un carácter @, seguido por dos pares de identificadores caverna.
The first pair indicates the passage in which Theseus starts, and the second in which the Minotaur starts.​




El primer par indica el pasaje en el que comienza a Teseo, y la segunda en la que el Minotauro se inicia.
The travel in a starting passage is toward the cavern whose identifier is the second character in the pair.​




El viaje en un pasaje de partida es hacia la caverna cuyo identificador es el segundo personaje en el par.
Theseus and Minotaur will never start in the same corridor. The file will be terminated by a line consisting of a single #.​


Teseo y el Minotauro no se iniciará en el mismo corredor. El archivo se dará por terminado por una línea que consiste en una sola #.

A final encounter is possible for each input data set.​
Un encuentro final es posible para cada uno de datos de entrada.

Output
Salida

Output will consist of one line for each labyrinth.​


Salida consistirá en una línea para cada laberinto.
Each line will specify who gets killed and where.​




Cada línea se especifica quién se mata y dónde.
Note that if the final encounter takes place in a passage it should be specified from Theseus' point of view.​




Tenga en cuenta que si el encuentro final tiene lugar en un pasaje que conviene precisar desde el punto de Teseo de vista.
Follow the format shown in the example below exactly, which describes the situations referred to above.​


Siga el formato que se muestra en el siguiente ejemplo exactamente, que describe las situaciones antes mencionadas.

Sample Input


Ejemplo de entrada
A:BCD​




A: BCD
:eek:BACG​




:eek: BACG
F:HE​




F: SE
G:HED​




G: HED
B:AD​




B: AD
E:FGH​




E: FGH
H:FEG​




H: FEG
C:AD​




C: AD
@ACFH​




@ ACFH
A:BCD​




A: BCD
:eek:BACG​




:eek: BACG
F:HE​




F: SE
G:HED​




G: HED
B:AD​




B: AD
E:FGH​




E: FGH
H:FEG​




H: FEG
C:AD​




C: AD
@ACDG​




@ ACDG
#​


#

Sample Output


Ejemplo de salida
Theseus is killed between D and G​




Teseo se mata entre D y G
The Minotaur is slain in H​


El Minotauro es asesinado en H
 

Zephyros

Bovino de la familia
#2
Y qué llevas hecho de todo el choro que te aventáste aquí?

Si deseas ayuda, debes mostrar un avance y la parte del código donde estés "atorado", con base en ello, plantea tus dudas.

No esperabas que te lo hiciéramos todo verdad? X_X

Aquí no le hacemos la tarea a nadie!!!! (Por si acaso... XD)
 
#4
#include<stdio.h>
#include<cstdlib>
#include<string.h>
#include<conio.h>
using namespace std;

int prog()
{
system("cls");
system("color F4");
FILE *arch;
FILE *out;
char nom[80], mat[9][6];
char lab[2][4],t,m,tempt[1],tempm[1],frase[40]="Teseo se mata entre ";
int lab2[2][4],bandera=0,a=0,b=0,c=0,d=0,y=0;

lab[0][0]= 'A';
lab[0][1]= 'B';
lab[1][0]= 'C';
lab[1][1]= 'D';
lab[0][2]= 'E';
lab[0][3]= 'F';
lab[1][2]= 'G';
lab[1][3]= 'H';

arch=fopen("saul.txt","r");//cuando es r
out=fopen("salida.txt","w");

if(arch!=NULL)
{
while(!feof(arch))
{
for(int i=0;i<9;i++)
{
fgets(nom,10,arch);
for(int j=0;j<strlen(nom);j++)
{
mat[j]=nom[j];
printf("%c",mat[j]);
}
}

t=mat[8][3];
m=mat[8][5];

for(a=0;a<2;a++)
{
for(int b=0;b<4;b++)
{
if(t==lab[a]) lab[a]=1;
else if(m==lab[a]) lab2[a]=2;
}
}

while(bandera!=1)
{
for(y=0;y<3;y++)
{ //printf("ENtra al if de los tres turnos");
for(c=0;c<8;c++)
{//printf("Entra al if de ");
if(mat[c][0]==t)
{
for(d=0;d<5;d++)
{
if(mat[c][d]=='\0') break;
else tempt[0]=mat[c][d];

}
}
if(tempt[0]!='\0') break;
}
printf("\n%s",tempt[0]);
getche();

for(c=0;c<8;c++)
{
if(mat[c][0]==m)
{
for(d=0;d<5;d++)
{
if(mat[c][d]=='\0') break;
else tempm[0]=mat[c][d];
}
}
if(tempm[0]!='\0') break;
}
printf("\n%s",tempm[0]);
getche();
for(c=0;c<8;c++)
{
if(mat[c][0]==tempt[0])
{
for(d=0;d<5;d++)
{
if(mat[c][d]==tempm[0])
{
strcat(frase,tempt);
strcat(frase, " y ");
strcat(frase, tempm);
fputs(frase, out);
bandera=1;
}

}
}
}

if((y==3)&&(bandera==0))
{
for(a=0;a<2;a++)
{
for(b=0;b<4;b++)
{
if(t==lab[a]) lab[a]=1;
else if(m==lab[a]); lab2[a]=1;
}
}
}
}
if(bandera==1) break;
}
}
}
else
{
printf("\nNo Existe");
getch();
system("cls");
}
fclose(arch);
fclose(out);
}

int main()
{
prog();
getche();
}


nomas tengo eso y no se xq se me cicla no pueden ayudarme
 
Arriba