- 520 名前:デフォルトの名無しさん mailto:sage [02/07/21 14:55]
- #include <stdio.h>
size_t l,r=~0,z,q,e,u[257],g,f[256];main(int a,char**v){FILE*n=fopen(v[2],"rb" ),*o=fopen(v[3],"wb");int c=4,x=256,(*t)()=fgetc;if(g=*v[1]-69)for(fread(&z,4, 1,n),fread(f,4,x,n);c--;)e=e*x|t(n);else{while(~(c=t(n)))z++,f[c]<255?f[c]++:0 ;fwrite(&z,4,1,o);fwrite(f,4,x,o);fseek(n,0,0);}for(c=0;c<x;c++)u[c+1]=u[c]+f[ c];while(g?z--:~(c=t(n))){r/=u[x];if(g){for(q=(e-l)/r,c=x;--c&&q<u[c];);fputc( c,o);}for(l+=u[c]*r,r*=f[c];(l^l+r)<1<<24||r<1<<16&&(r=65535&~l+1);)g?(e=e*x|t (n)):fputc(l>>24,o),r*=x,l*=x;}if(!g)for(c=4;c--;)fputc(l>>24,o),l*=x;} 出力サイズは増えるが八行。 これ以上は厳しいかも
|

|