Welcome to ZOJ
Select Problem
ZOJ Problem Set - 1584
Crack Me

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Sunny Cup 2003 - Preliminary Round

April 20th, 12:00 - 17:00

Problem C: Crack Me

The U.S. war on Iraq seems to sweep everything off the country except Mr Saddam's fund in Switzerland. A secret war is going on through the Internet, while you, member of the largest hacker organization in the world, get this fairly profitable job.

Mr Saddam is quite careful about his money and sets the authentication system all by himself. Fortunately, you finally acquire the source code of the system from your men inside.

After the source is compiled, it takes in a query string whose length is greater than or equal to 1, and less than 4096. It is made up of entirely digits of 0 to 9 and the output is the key to the fund in the bank.

Here is the source code:

#include <stdio.h>
#include <string.h>
#define A else
#define B strlen(d)
#define C char
#define D d[I]
#define E break;
#define F(x) for(x)
#define G continue;
#define H H
#define I I
#define J J
#define K K
#define L L
#define M memset(r,'0',sizeof(r))
#define N N
#define O O
#define P printf
#define Q(x) return x
#define R r[I]
#define S(x) x<0?0:x
#define T int
#define U 1<<12
#define V T I,J,K
#define W(x) while(x)
#define X(x) if(x)
#define Y fgets(d,U,stdin)
#define Z void
C d[U], r[U]; T N; T L(){ V; F( I=N-1; I>=N/2; I--) X(!(D-48)) D=57; A{ D--; E;}
X((I<<1)<N) Q(0); F( I=J=0; (I<<1)<N; I++){ K=R+D+J-96; J=K/10; R=K%10+48;}W(J){
K=R+J-48; J=K/10;R=K%10+48; I++;} Q(1);} Z O(){V;F(I=U-1;I;I--) X(R-48)E;I=S(I);
W(I >= 0){P("%c",R); I--;}P("%c",10);}int main(){V;W(Y){N=B;d[--N]=0;X(N > U-2){


The input contains multiple tests. Each test is a string of digits described above. The input is terminated with end of file. There will not be any blank lines.


The key to the input, one on each line.

Sample Input & Output

Please run the source to get as many as you like :)

Author: CHENG, Long
Source: Zhejiang University Local Contest 2003, Preliminary
Submit    Status