1006 - Ciphering Programs 1006 - Cifrando programas 1006 - Ciphering Programs

Estatísticas Env: 1848 | AC: 541 | %AC: 29,27 | Pontoação: 0,41
Criado por 2010 Copa Pascal UCI
Adicionado por ejaltuna (2011-10-13)
Límiteis
Tempo Total: 2000 MS |Memória: 62 MB | Saída límite (mb): 64 MB | Tamanho: 4 KB
Lenguagens activados
Disponivel em

Descripção

Enrique and Tomás are two good friends whose greatest entertainment is programming. As all good programmers, they challenge each other frequently, the challenges consisting mostly in solving online judge problems in as little time as possible. Enrique has observed that one of the motives that competition between them has become more even is the sharing of solutions between the two. This allows each programmer to know the tricks of the other. Enrique has decided to hide his solutions from Tomás and everyone else, but he has an inconvenience to guarantee it: He shares a workstation with Tomás. Wanting to avoid accidental access to his code he decides to encrypt everything in his programs. In order to do so he implements the following algorithm: Change every letter in the code for its successor in the English alphabet (respecting its case). If the letter in question is z, then its successor is assumed to be a. Then the algorithm rewrites each line as described as follows: first, the symbol in the centre of the text is written (if characters goes from positions 1 to n, then the first character in being written is the character in position (1+n)/2). Following the same strategy, the algorithm encodes the left half of the string, then the right and last half. Thus, the Pascal program:
program p1000(Input,Output);
var
    a,b:Integer;
begin
    Readln(a,b);
    Writeln(a+b);
end.
will be:
(npqsshb1 q000PqJouv,vuvq)u;
bws
:    ,bcfoJufhs;
hcfjo
e    fSbbom(c,);
f    sXjubom(c+);
ofe.
Enrique took a while programming the encoder, and now wants to ask you to help him revert the encryptions.
;jsessionid=AE3DC8617A4D5093686ED2893170328E
Enrique y Tomás son dos buenos amigos cuyo mayor entretenimiento es la programación. Como todos los buenos programadores, se desafían con frecuencia, los retos consisten principalmente en la resolución de problemas en los jueces línea en el menor tiempo posible. Enrique ha observado que uno de los motivos por lo que la competencia entre ellos se ha hecho más pareja es el intercambio de soluciones entre los dos. Esto permite a cada programador conocer los trucos del otro. Enrique ha decidido ocultar sus soluciones de Tomás y todos los demás, pero tiene un inconveniente para garantizarlo: Él comparte una estación de trabajo con Tomás. Queriendo evitar el acceso accidental a su código decide cifrar todo en sus programas. Con el fin de hacer esta tarea implementa el algoritmo siguiente: Cambia cada letra en el código por su sucesora en el alfabeto Inglés (respetando si son mayúsculas o minúsculas). Si la letra en cuestión es la z, entonces su sucesora es una a. Luego el algoritmo vuelve a escribir cada línea como se describe a continuación: primero, el símbolo en el centro del texto es escrito (si los caracteres van de las posiciones 1 a n, entonces el primer carácter que se escribe es el carácter en la posición (1 + n) / 2). Siguiendo la misma estrategia, el algoritmo codifica la mitad izquierda de la cadena, a continuación la derecha y última mitad. De este modo, el programa en Pascal:

program p1000(Input,Output);
var
    a,b:Integer;
begin
    Readln(a,b);
    Writeln(a+b);
end.
será:
(npqsshb1 q000PqJouv,vuvq)u;
bws
:    ,bcfoJufhs;
hcfjo
e    fSbbom(c,);
f    sXjubom(c+);
ofe.
A Enrique le tomó un rato programar el codificador, y ahora quiere pedirle a usted que le ayude a revertir las encriptaciones.
Enrique and Tomás are two good friends whose greatest entertainment is programming. As all good programmers, they challenge each other frequently, the challenges consisting mostly in solving online judge problems in as little time as possible. Enrique has observed that one of the motives that competition between them has become more even is the sharing of solutions between the two. This allows each programmer to know the tricks of the other. Enrique has decided to hide his solutions from Tomás and everyone else, but he has an inconvenience to guarantee it: He shares a workstation with Tomás. Wanting to avoid accidental access to his code he decides to encrypt everything in his programs. In order to do so he implements the following algorithm: Change every letter in the code for its successor in the English alphabet (respecting its case). If the letter in question is z, then its successor is assumed to be a. Then the algorithm rewrites each line as described as follows: first, the symbol in the centre of the text is written (if characters goes from positions 1 to n, then the first character in being written is the character in position (1+n)/2). Following the same strategy, the algorithm encodes the left half of the string, then the right and last half. Thus, the Pascal program:
program p1000(Input,Output);
var
    a,b:Integer;
begin
    Readln(a,b);
    Writeln(a+b);
end.
will be:
(npqsshb1 q000PqJouv,vuvq)u;
bws
:    ,bcfoJufhs;
hcfjo
e    fSbbom(c,);
f    sXjubom(c+);
ofe.
Enrique took a while programming the encoder, and now wants to ask you to help him revert the encryptions.
;jsessionid=AE3DC8617A4D5093686ED2893170328E

Especificação de entrada

The input consists of one program, encoded as per the strategy suggested by Enrique.
No line in this program contains more than 20000 characters.
La entrada consiste en un programa, codificado según la estrategia sugerida por Enrique.
Ninguna línea en este programa contiene más de 20000 caracteres.
The input consists of one program, encoded as per the strategy suggested by Enrique.
No line in this program contains more than 20000 characters.

Especificação de saída

The output consists of Enrique's program decoded. This result will be exactly the same to the program originally described.
La salida consiste en el programa de Enrique decodificado. Este resultado será exactamente el mismo que el programa descrito originalmente.
The input consists of one program, encoded as per the strategy suggested by Enrique.
No line in this program contains more than 20000 characters.

Exemplo de entrada

(npqsshb1 q000PqJouv,vuvq)u;
bws
:    ,bcfoJufhs;
hcfjo
e    fSbbom(c,);
f    sXjubom(c+);
ofe.

Exemplo de saída

program p1000(Input,Output);
var
    a,b:Integer;
begin
    Readln(a,b);
    Writeln(a+b);
end.

Sugestões(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recomendação

Temos seleccionado cuidadosamente varios problemas similares: 3376 | 2769 | 1873 | 2441 | 2534 | 2141