Created
May 1, 2012 15:16
-
-
Save buty4649/2568721 to your computer and use it in GitHub Desktop.
akari.cをわかりやすくしてみた (see. http://www.ioccc.org/2011/akari/hint.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Don Yang | |
// <[email protected]> | |
// <http://uguu.org/> | |
#include<stdio.h> | |
int main(int n,char **m) | |
{ | |
FILE *p,*q; | |
int A,k,a,r,i; | |
char *d = "P%" "d\n%d\40%d\n%d\n\00wb+", | |
b[1024], | |
y[]="yuriyurarararayuruyuri*daijiken**akkari~n**" | |
"/y*u*k/riin<ty(uyr)g,aur,arr[a1r2a82*y2*/u*r{uyu}riOcyurhiyua**rrar+*arayra*=" | |
"yuruyurwiyuriyurara'rariayuruyuriyuriyu>rarararayuruy9uriyu3riyurar_aBrMaPrOaWy^?" | |
"*]/f]`;hvroai<dp/f*i*s/<ii(f)a{tpguat<cahfaurh(+uf)a;f}vivn+tf/g*`*w/jmaa+i`ni(" | |
"i+k[>+b+i>++b++>l[rb"; | |
int u; | |
for(i=0;i<101;i++) { | |
y[i*2] ^= "~hktrvg~dmG*eoa+%squ#l2" | |
":(wn\"1l))v?wM353{/Y;lgcGp`vedllwudvOK`cct~[|ju {stkjalor(stwvne\"gt\"yogYURUYURI" | |
[i]^y[i*2+1]^4; | |
} | |
// 引数解析 | |
p=(n>1 && (m[1][0] -'-' || m[1][1]!='\0')) ? fopen(m[1],y+298) : stdin; | |
q=(n<3 ||!(m[2][0] -'-' || m[2][1])) ? stdout : fopen(m[2],d+14); | |
// 入力・出力ファイルがオープンできたか確認 | |
if(!p || !q) { | |
return printf( | |
// "Can ""not\x20open\40%s\40" "" "for\40%sing\n",m[!p?1:2],!p?"read":"writ"); | |
"Can not open %s for %sing\n", | |
m[!p?1:2], | |
!p ? "read" :"writ" | |
); | |
} | |
for(a=k=u=0;y[u];u=2+u){ | |
y[k++] = y[u]; | |
} | |
if((a=fread(b,1,1024,p)) > 2 && b[0] =='P' && | |
4==sscanf(b,d,&k,& A,&i,&r)&&!(k-6&&k-5)&&r==255) | |
{ | |
u=A; | |
if(n>3){ | |
u++; | |
i++; | |
} | |
fprintf(q,d,k,u>>1,i>>1,r); | |
u= k-5 ? 8 : 4; | |
k=3; | |
} else { | |
(u)=+(n+14>17) ? 8 / 4 : 8 *5/ 4; | |
} | |
for(r=i=0;;) | |
{ | |
u*=6; | |
u+=(n>3?1:0); | |
if(y[u]&01) { | |
fputc((r),q); | |
if(y[u]&16) { | |
k=A; | |
} | |
if(y[u]&2) { | |
k--; | |
} | |
if(i==a) { | |
i=a=(u)*11&255; | |
} | |
if(1&&0>=(a=fread(b,1,1024,p)) | |
&& | |
")]i>(w)-;} { /i-f-(-m--M1-0.)<{"[8] | |
// ^ ;(=> ASCIIコードで0x3b) | |
==59) | |
{ | |
break; | |
} | |
i=0; | |
} | |
r=b[i++]; | |
u+=(+8&*(y+u)) ? (10-r?4:2) : | |
(y[u]&4) ? | |
(k?2:4) | |
: 2; | |
u=y[u]-(int)'`'; | |
// ` = 0x60 | |
} | |
fclose(p); | |
k=fclose(q); | |
return k--1+(-0x01); | |
// kの戻り値をそのまま返す | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment