Crack Me
Time Limit: 1 Second Memory Limit: 32768 KB
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){ P("0\n");G;}X(N-(N>>1)-(N>>1)){d[N++]='0';d[N]=0;}M;W(L());O();}}
Input
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.
Output
The key to the input, one on each line.
Please run the source to get as many as sample input and output you like :) SubmitSource: Zhejiang University Local Contest 2003, Preliminary