想起在网上找找这个是因为lakeblur给我发过这样一个C代码:
#include <stdio.h>
main(t,_,a)
char *a;
{
return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86,0,a+1)+a)):
1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13?
main(2,_+1,"%s %d %dn"):9:16:t<0?t<-72?main(_,t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#
;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l
q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;#
){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw'
iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c
;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')#
}'+}##(!!/")
:t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main((*a=='/')+t,_,a+1)
:0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a,
"!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);
}
程序编译运行后不可思议地打印出一长段超过源代码长度的文字,而这些字串竟然根本没有在源代码中出现过。我知道C代码可以写得很怪,而且看这个程序估计还用了不少递归;但从没有想过还有如此荒唐的源代码,看上去基本上就是乱码。刚才我搜索到,这段代码是IOCCC的一个获奖作品。
IOCCC即International Obfuscated C Code Contest,比谁的C代码写得最乱最读不懂。
这个比赛已经举办了17年了,下面是近几年的一些获奖作品。
你可以在http://www.au.ioccc.org/years.html看到更多,但很多需要在Linux环境下编译运行。比较有趣的又能够在windows环境下运行都已经在下面了。
我们假设你编译后的文件名都是abc.exe。
编译后在dos下输入abc "ash nazg durhbatuluhk, ash nazg gimbatul, ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >abc.pgm
然后用图片编辑器查看abc.pgm
#include
<stdio.h>
#include <stdlib.h>
#include <string.h>
#define w "Hk~HdA=Jk|Jk~LSyL[{M[wMcxNksNss:"
#define r"Ht@H|@=HdJHtJHdYHtY:HtFHtF=JDBIl"
"DJTEJDFIlMIlM:HdMHdM=I|KIlMJTOJDOIlWITY:8Y"
#define S"IT@I\@=HdHHtGH|KILJJDIJDH:H|KID"
"K=HdQHtPH|TIDRJDRJDQ:JC?JK?=JDRJLRI|UItU:8T"
#define _(i,j)L[i=2*T[j,O[i=O[j-R[j,T[i=2*
R[j-5*T[j+4*O[j-L[j,R[i=3*T[j-R[j-3*O[j+L[j,
#define t"IS?I\@=HdGHtGIDJILIJDIItHJTFJDF:8J"
#define y yy(4),yy(5), yy(6),yy(7)
#define yy( i)R[i]=T[i],T[i ] =O[i],O[i]=L [i]
#define Y _(0 ], 4] )_ (1 ], 5] )_ (2 ], 6] )_ (3 ], 7] )_=1
#define v(i)( (( R[ i ] * _ + T [ i ]) * _ + O [ i ]) * _ + L [ i ]) *2
double b = 32 ,l ,k ,o ,B ,_ ; int Q , s , V , R [8 ], T[ 8] ,O [8 ], L[ 8] ;
#define q( Q,R ) R= *X ++ % 64 *8 ,R |= *X /8 &7 ,Q=*X++%8,Q=Q*64+*X++%64-256,
# define p "G\QG\P=GLPGTPGdMGdNGtOGlOG" "dSGdRGDPGLPG\LG\LHtGHtH:"
# define W "Hs?H{?=HdGH|FI\II\GJlHJ" "lFL\DLTCMlAM\@Ns}Nk|:8G"
# define U "EDGEDH=EtCElDH{~H|AJk}" "Jk?LSzL[|M[wMcxNksNst:"
# define u "Hs?H|@=HdFHtEI" "\HI\FJLHJTD:8H"
char * x ,*X , ( * i )[ 640],z[3]="4_",
*Z = "4,8O4.8O4G" r U "4M"u S"4R"u t"4S8CHdDH|E=HtAIDAIt@IlAJTCJDCIlKI\K:8K"U
"4TDdWDdW=D\UD\VF\FFdHGtCGtEIDBIDDIlBIdDJT@JLC:8D"t"4UGDNG\L=GDJGLKHL
FHLGHtEHtE:"p"4ZFDTFLT=G|EGlHITBH|DIlDIdE:HtMH|M=JDBJLDKLAKDALDFKtFKdMK
\LJTOJ\NJTMJTM:8M4aGtFGlG=G|HG|H:G\IG\J=G|IG|I:GdKGlL=G|JG|J:4b"W
S"4d"W t t"4g"r w"4iGlIGlK=G|JG|J:4kHl@Ht@=HdDHtCHdPH|P:HdDHdD=It
BIlDJTEJDFIdNI\N:8N"w"4lID@IL@=HlIH|FHlPH|NHt^H|^:H|MH|N=J\D
J\GK\OKTOKDXJtXItZI|YIlWI|V:8^4mHLGH\G=HLVH\V:4n" u t t
"4p"W"IT@I\@=HdHHtGIDKILIJLGJLG:JK?JK?=JDGJLGI|MJDL:8M4
rHt@H|@=HtDH|BJdLJTH:ITEI\E=ILPILNNtCNlB:8N4t"W t"4u"
p"4zI[?Il@=HlHH|HIDLILIJDII|HKDAJ|A:JtCJtC=JdLJtJL
THLdFNk|Nc|
:8K"; main (
int C,char** A) {for(x=A[1],i=calloc(strlen(x)+2,163840);
C-1;C<3?Q=_= 0,(z[1]=*x++)?((*x++==104?z[1]^=32:--x), X =
strstr(Z,z)) &&(X+=C++):(printf("P2 %d 320 4 ",V=b/2+32),
V*=2,s=Q=0,C =4):C<4?Q-->0?i[(int)((l+=o)+b)][(int)(k+=B)
]=1:_?_-=.5/ 256,o=(v(2)-(l=v(0)))/(Q=16),B=(v(3)-(k=v(1)
))/Q:*X>60?y ,q(L[4],L[5])q(L[6],L[7])*X-61||(++X,y,y,y),
Y:*X>57?++X, y,Y:*X >54?++X,b+=*X++%64*4:--C:pri
ntf("%d "
,i[Q][s]+i[Q ][s+1]+i[Q+1][s]+i[Q+1][s+1])&&(Q+=2)<V||(Q=
0,s+=2)<640
||(C=1));}
编译后在dos下输入abs > ioccc_ray.ppm,生成一个图片(等得可能有点久)
X=1024; Y=768; A=3;
J=0;K=-10;L=-7;M=1296;N=36;O=255;P=9;_=1<<15;E;S;C;D;F(b){E="1""111886:6:??AAF"
"FHHMMOO55557799@@>>>BBBGGIIKK"[b]-64;C="C@=::C@@==@=:C@=:C@=:C5""31/513/5131/"
"31/531/53"[b ]-64;S=b<22?9:0;D=2;}I(x,Y,X){Y?(X^=Y,X*X>x?(X^=Y):0, I (x,Y/2,X
)):(E=X); }H(x){I(x, _,0);}p;q( c,x,y,z,k,l,m,a, b){F(c
);x-=E*M ;y-=S*M ;z-=C*M ;b=x* x/M+ y*y/M+z
*z/M-D*D *M;a=-x *k/M -y*l/M-z *m/M; p=((b=a*a/M-
b)>=0?(I (b*M,_ ,0),b =E, a+(a>b ?-b:b)): -1.0);}Z;W;o
(c,x,y, z,k,l, m,a){Z=! c? -1:Z;c <44?(q(c,x ,y,z,k,
l,m,0,0 ),(p> 0&&c!= a&& (p<W ||Z<0) )?(W=
p,Z=c): 0,o(c+ 1, x,y,z, k,l, m,a)):0 ;}Q;T;
U;u;v;w ;n(e,f,g, h,i,j,d,a, b,V){o(0 ,e,f,g,h,i,j,a);d>0
&&Z>=0? (e+=h*W/M,f+=i*W/M,g+=j*W/M,F(Z),u=e-E*M,v=f-S*M,w=g-C*M,b=(-2*u-2*v+w)
/3,H(u*u+v*v+w*w),b/=D,b*=b,b*=200,b/=(M*M),V=Z,E!=0?(u=-u*M/E,v=-v*M/E,w=-w*M/
E):0,E=(h*u+i*v+j*w)/M,h-=u*E/(M/2),i-=v*E/(M/2),j-=w*E/(M/2),n(e,f,g,h,i,j,d-1
,Z,0,0),Q/=2,T/=2, U/=2,V=V<22?7: (V<30?1:(V<38?2:(V<44?4:(V==44?6:3))))
,Q+=V&1?b:0,T +=V&2?b :0,U+=V &4?b:0) :(d==P?(g+=2
,j=g>0?g/8:g/ 20):0,j >0?(U= j *j/M,Q =255- 250*U/M,T=255
-150*U/M,U=255 -100 *U/M):(U =j*j /M,U<M /5?(Q=255-210*U
/M,T=255-435*U /M,U=255 -720* U/M):(U -=M/5,Q=213-110*U
/M,T=168-113*U / M,U=111 -85*U/M) ),d!=P?(Q/=2,T/=2
,U/=2):0);Q=Q< 0?0: Q>O? O: Q;T=T<0? 0:T>O?O:T;U=U<0?0:
U>O?O:U;}R;G;B ;t(x,y ,a, b){n(M*J+M *40*(A*x +a)/X/A-M*20,M*K,M
*L-M*30*(A*y+b)/Y/A+M*15,0,M,0,P, -1,0,0);R+=Q ;G+=T;B +=U;++a<A?t(x,y,a,
b):(++b<A?t(x,y,0,b):0);}r(x,y){R=G=B=0;t(x,y,0,0);x<X?(printf("%c%c%c",R/A/A,G
/A/A,B/A/A),r(x+1,y)):0;}s(y){r(0,--y?s(y),y:y);}main(){printf("P6n%i %in255"
"n",X,Y);s(Y);}
编译后输入abc 0 0 1可以画出x^2的函数图像,输入abc -1 0 0 1可以画出x^3-1的图像。你也可以试试其它的。
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define _ ;double
#define void x,x
#define case(break,default) break[O]:default[O]:
#define switch(bool) ;for(;x<bool;
#define do(if,else) inIine(else)>int##if?
#define true (--void++)
#define false (++void--)
char*O=" <60>!?\n"_ doubIe[010]_ int0,int1 _ Iong=0 _ inIine(int eIse){int
O1O=!O _ l=!O;for(;O1O<010;++O1O)l+=(O1O[doubIe]*pow(eIse,O1O));return l;}int
main(int booI,char*eIse[]){int I=1,x=-*O;if(eIse){for(;I<010+1;I++)I[doubIe-1]
=booI>I?atof(I[eIse]):!O switch(*O)x++)abs(inIine(x))>Iong&&(Iong=abs(inIine(x
)));int1=Iong;main(-*O>>1,0);}else{if(booI<*O>>1){int0=int1;int1=int0-2*Iong/0
[O]switch(5[O]))putchar(x-*O?(int0>=inIine(x)&&do(1,x)do(0,true)do(0,false)
case(2,1)do(1,true)do(0,false)6[O]case(-3,6)do(0,false)6[O]-3[O]:do(1,false)
case(5,4)x?booI?0:6[O]:7[O])+*O:8[O]),x++;main(++booI,0);}}}
高精度开方。这个有点意思,已经发到OIBH上了。
输入abc 01524157875019052100试试。
你输入的数字需要有偶数位,否则自行添加前导0补足。
#include <stdio.h>
int l;int main(int o,char **O,
int I){char c,*D=O[1];if(o>0){
for(l=0;D[l ];D[l
++]-=10){D [l++]-=120;D[l]-=
110;while (!main(0,O,l))D[l]
+= 20; putchar((D[l]+1032)
/20 ) ;}putchar(10);}else{
c=o+ (D[I]+82)%10-(I>l/2)*
(D[I-l+I]+72)/10-9;D[I]+=I<0?0
:!(o=main(c/10,O,I-1))*((c+999
)%10-(D[I]+92)%10);}return o;}
画一个月亮
#include <stdio.h>
#include <math.h>
double l;main(_,o,O){return putchar((_--+22&&_+44&&main(_,-43,_),_&&o)?(main(-43,++o,O),((l=(o+21)/sqrt(3-O*22-O*O),l*l<4&&(fabs(((time(0)-607728)%2551443)/405859.-4.7+acos(l/2))<1.57))[" #"])):10);}
类似于hangman的猜单词游戏
#ifndef int
#ifdef while
char s[234],d[56],*p=s,m='m';
#define int typedef (*define)();
define O [6]={getc,putchar,(y)memmove,(y)printf,(y)n,(y)l};
#include __FILE__
signed short n(short bz){
short pb=0,Md=1,ih=2,sfp=3,sjs=4,fo,u=5,scp=6,t,gq=7,oh,r=8,pcf=9,rs=10;
char o=1,i=1,l,pc=i,b=r+o/2,_f=6,m=7,s=8,g,q,od=o*rs+4^s,js=_f/*3-m*'c',bs='g';
return 1; }
#y FILE c[a]+s,p[c],r[m]+u[i+4*o|f]-r[wob][wad]+s*f-!w|o,L+x | cut
;}int main(i,love_unix){*/;}int main(i,love_unix){/*;}int main(i,love_unix){*;}| here */
while(FILE)for(;9-(i=0[O](f)););
for(;32-(i=0[O](f));0&& 3[O]("-->%s<--", "gxdgbtgxsxpcctvpixktedhiedcte"));
for(;'n
'-(i=O[0](f));)(i>='a'&&i<'z')?*
#include __FILE__
"Demonic Smiley" );} /* <g> */
#else
#define while(int) short c=0;int*f=fopen(__##int##__,"r");for(i=0;i<25;i _)i[d]='A'+(13+i)%26;main:
#define y define
#define _ ++
#include <stdio.h>
#include <string.h>
#include <time.h>
#include __FILE__
#endif
#elif defined(signed)
(p _)=(i-'a')[d]:!(i-'z')?*(p _)=32:(i>='A'&&i<='Z')&&((3&8|2)[O](d+1,d,24L),*(p _)=0[d]=i);/*
#y FILE t,ra|js+t*gj,at[qdd]-=K,is _,qv _,veb _,ti _,ao[mqht] _*/
if(c _<6) goto main; 5[O](
#else
#define signed short l(){char q='_';p=s+4*(time(NULL)%24)*2,m=(char)p+1;
*(p+8)=0; for(d[3]=10,d[33]=3[d]-10;d[3]<18;3[d] _) d[3][p]=q;3[d][p]=0;
hell: printf("t[%s]n",p+10);if(!m) goto stoned;
froze: d[8]=(scanf("%c",&(2[d+__STDC__])),2[d+!NULL])&223;if(!(3[d+5]-'n')) goto froze;
for(m=1[d]=0;d[1]<8;2[d-1] _) (p[d[1]]-d[8]||(p[3[d-2]+10]=4[d+4]))+(p[d[1]+10]-q||m _);
goto hell;stoned:;}
FILE *X(FILE s){ char i,iev,jmqhu,xqht,mqh,ujek,sxydw,kdj,yjb,utou,qhre,eamy,jxxe,bt;}
#endif
把儿加油
国际乱码大赛很有意思.
第一个程序似乎已经是非法的了~~~~~
C99好像已经禁止了直接调用main函数~~~~~
最经典的还是那个只有一行的。。输出的是unix
输出的不是unix,是uniz
have fun 那个?
我擦。。。
太奇葩了。。。
长见识了。。。
回复 xxzc:
就是 have fun 那个,输出的是 uniz
为什么在code:blocks里面都无法编译呢……
回复地下室:
输出的是unix,要用linux编译,刚试过
Having read this I thought it was rather informative.
I appreciate you spending some time and effort
to put this short article together. I once again find myself spending a lot of time both reading
and commenting. But so what, it was still worthwhile!
I need to to thank you for this great read!! I absolutely loved every bit of
it. I have you book-marked to look at new stuff you post…
I am sure this article has touched all the internet
users, its really really good article on building up new weblog.
She started her freelance business enterprise in 2015, went ull time inn 2016,
had her second child in 2017, andd hit six figures inn
2018.
My web site 비제이 알바
The representative APR is the rate a provider
reasonably expects most applicants to get.
Check out my page: 대출직빵
As an alternative of standard employment, CashUSA’s companion lenders proritize income sources.
Review my web site 정부지원대출
Plus, it does not hurt that the governor is the owner of 1 of the state’s fie casinos.
Here is my pagee – read more
There are everyday odsds boosts and the Construct Your Personal Bet
function is a wonderful addition too the app.
my blog – 해외토토사이트
Can I show my graceful appreciation and shout out
on really good stuff and if you want to with no joke truthfully see Let me tell you a brief about
how to get connected to girls easily and quick I am
always here for yall you know that right?
Firstly, it is illegal for a Korean citizen to gamble in Korea (there is one casino that
exempts citizens from this law) — this applies for Koreans overseas as
well.
Also visit my website – site
I believe people who wrote this needs true loving because it’s a blessing.
So let me give back and finally give back change your life and if you want to seriously get to hear I will share info about howto make money Don’t forget..
I am always here for yall. Bless yall!
The Delaware Division of Gaming Enforcement controls all gaming activities.
My blog post … 메이저사이트
I savour, result in I discovered just what I used to be having a
look for. You’ve ended my 4 day long hunt! God Bless
you man. Have a great day. Bye