Merge pull request #318 from xexyl/2015-endoh3
This commit is contained in:
18 files changed
+46
-49
No files matched your search
+1
-1
@@ -16,7 +16,7 @@ you Yusuke!
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) removed the erroneous
|
||||
prototype to `fopen()` and made this use `fgets()` instead of `gets()` to make
|
||||
it safer. He also fixed a segfault in the case that the file cannot be loaded.
|
||||
it safer and to prevent a potentially alarming warning at linking or runtime.
|
||||
Thank you Cody for your assistance!
|
||||
|
||||
## To run
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?fgets(p=B,R,stdin),P[*d]=S():(*(q=Q(B,"TH
|
||||
()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i
|
||||
=B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[
|
||||
*B]=S();l++;}X'L':N printf(I)X'N':N(free(m[i]),0),m[i]=0 X'B':_ 0 t('S',5,"w",N
|
||||
f&&fprintf(f,I))t('O',4,"r",while(f&&fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G()
|
||||
fprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B,"\n")=0,G()))X 0:default:G()
|
||||
;}_ 0;}G(){l=atoi(B);m[l]&&(free(m[l]),0);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p
|
||||
)),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V,'$',<=,'!',>=)
|
||||
O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<=
|
||||
|
||||
@@ -133,6 +133,7 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
@echo "NOTE: this entry will segfault on no arg specified."
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
sorter.c: ${PROG} ${PROG}.c
|
||||
|
||||
+14
-14
@@ -1,10 +1,10 @@
|
||||
# Best of Show
|
||||
|
||||
Adrian Mariano
|
||||
University of Washington
|
||||
2729 72nd Ave SE
|
||||
Mercer Island, WA 98040
|
||||
USA
|
||||
Adrian Mariano
|
||||
University of Washington
|
||||
2729 72nd Ave SE
|
||||
Mercer Island, WA 98040
|
||||
USA
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -12,13 +12,12 @@
|
||||
make all
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults
|
||||
under modern (and in some cases earlier) systems with this entry. He also fixed
|
||||
a segfault if not enough args are used. Originally we noted that the 4 trailing
|
||||
args '0 0 0 0' were required on systems that dump core when NULL is dereferenced
|
||||
but this problem showed itself in modern systems even with the 4 '0 0 0 0'. To
|
||||
make this easier for users Cody also kindly fixed this problem. Finally he
|
||||
changed this program to use `fgets()` not `gets()` to make it safer. Thank you
|
||||
Cody for your assistance!
|
||||
under modern (and in some cases earlier) systems with this entry. Originally we
|
||||
noted that the 4 trailing args '0 0 0 0' were required on systems that dump core
|
||||
when NULL is dereferenced but this problem showed itself in modern systems even
|
||||
with the 4 '0 0 0 0'. Finally he changed this program to use `fgets()` not
|
||||
`gets()` to make it safer and to prevent a warning about `gets()` at linking or
|
||||
runtime. Thank you Cody for your assistance!
|
||||
|
||||
[Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays
|
||||
needs `#include <stdlib.h>` which was used in order to get this to work
|
||||
@@ -37,6 +36,7 @@ where:
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)
|
||||
|
||||
NOTE: this entry will segfault on no arg specified.
|
||||
|
||||
## Try:
|
||||
|
||||
@@ -76,7 +76,7 @@ reversing filter! Try:
|
||||
Still not impressed? The author throws in for free, a
|
||||
sort program! Try:
|
||||
|
||||
cc sorter.c -o sorter
|
||||
make sorter
|
||||
ls | ./sorter
|
||||
|
||||
This program is safe for home use as well. The author has
|
||||
@@ -89,7 +89,7 @@ And finally, as a special offer to users of this entry,
|
||||
the author provides a Fibonacci sequence generator! Try:
|
||||
|
||||
./sorter 0 0 0 0 < theorem.c > fibonacci.c
|
||||
cc fibonacci.c -o fibonacci
|
||||
make fibonacci
|
||||
./fibonacci 1 1
|
||||
./fibonacci 2 1
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ w(g,R,u)float*g,u;char R;
|
||||
/**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}
|
||||
main(A,a)int A;char*a[];
|
||||
o o
|
||||
if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;
|
||||
if(!strcmp(*++a,"-r"))S();
|
||||
D=atof(*++a);
|
||||
T=atof(*++a);
|
||||
|
||||
@@ -128,6 +128,7 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
@echo "NOTE: this program will crash with not enough args."
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
|
||||
@@ -18,9 +18,8 @@ where:
|
||||
number is a number (try 21701)
|
||||
arg is any argument
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added a check in the
|
||||
code so that it will not segfault if not enough args are specified. Thank you
|
||||
Cody!
|
||||
|
||||
NOTE: this entry will crash without enough args.
|
||||
|
||||
## Judges' comments:
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
char*_,*O;main(S,l)char**l;{if(S>2){*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);}}
|
||||
char*_,*O;main(S,l)char**l;{*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);}
|
||||
@@ -128,6 +128,7 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
@echo "NOTE: this entry will segfault if the file cannot be opened."
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
# Obfuscated Intelligence Award:
|
||||
|
||||
Mark Schnitzius
|
||||
1700 Woodbury Rd. #1208
|
||||
Orlando, FL 32828
|
||||
USA
|
||||
Mark Schnitzius
|
||||
1700 Woodbury Rd. #1208
|
||||
Orlando, FL 32828
|
||||
USA
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to not
|
||||
segfault when no file is specified or the file cannot be opened for reading. He
|
||||
also made this use `fgets()` not `gets()` to make it safer. Thank you Cody for
|
||||
your assistance!
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this use `fgets()`
|
||||
not `gets()` to make it safer and to prevent a warning with linking or at
|
||||
runtime. Thank you Cody for your assistance!
|
||||
|
||||
## To run:
|
||||
|
||||
@@ -22,6 +21,8 @@ where:
|
||||
|
||||
file a file containing some text
|
||||
|
||||
NOTE: this entry will segfault if the file cannot be opened.
|
||||
|
||||
## Try:
|
||||
|
||||
./schnitzi schnitzi.info
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
( lll>l1 ) li|=! ( l[3*l1+++3
|
||||
] -ll[strlen ( ll)-1] ) ;return
|
||||
( li ) ;}main ( ll,lll
|
||||
) char*lll[];{if(ll<2)return 1;char l1 [111][21], li1[111][21],il1[111],i1l
|
||||
) char*lll[];{char l1 [ 111][21],li1[111][21 ] ,il1[111],i1l
|
||||
[ 111 ] ;int lli,l11,l1l,li/* ( */,ll1,il,l;FILE*f;if(ll-2
|
||||
) {f=fopen ( lll[1],"r" );if(!f)return 1;lli=l=ll1=il=!1;while
|
||||
) {f=fopen ( lll[1],"r" ) ;lli=l=ll1=il=!1;while
|
||||
( fscanf(f,"%s",l1[lli] ) +1){li=ii ( l1[lli],3
|
||||
) ;iii ( l1[lli] ) ;l1l=l11=!1;while
|
||||
( l1l>-ll ) {iii ( lll[-l1l]
|
||||
|
||||
@@ -130,6 +130,7 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
@echo "NOTE: this program will crash on invalid input."
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
|
||||
@@ -28,12 +28,10 @@
|
||||
echo 324 >> data
|
||||
./sort < data
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed three segfaults in
|
||||
this entry. The first was caused by invalid data types. The second was triggered
|
||||
if one did not specify any arg. The third happened if the arg was had any
|
||||
characters that were not the digits 1 - 9 (if it started with 0 it could work as
|
||||
long as another digit followed it and there were no other non-digits). Thank you
|
||||
Cody for your assistance!
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed invalid data
|
||||
types which prevented this entry from working. There are two other segfaults
|
||||
that should not be fixed and they are discussed in [bugs.md](/bugs.md). Thank
|
||||
you Cody for your assistance!
|
||||
|
||||
NOTE: the larger the number the number of lines of output can become
|
||||
substantially higher as well. Doing `./schnitzi 9` will actually print 771999
|
||||
|
||||
@@ -52,6 +52,5 @@ void x_(){ O=g; *r=y[k-2]; _=r; j=o_; }
|
||||
void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k<z; w=_t; l=p_; j=p; }
|
||||
void y_(){ O=g; *r=x[17][1]+k; _=r; j=q_; }
|
||||
void r_(){ O=_b; _=x[17]; s=(char**)_d; s=s+1; i=*s; q=0; }
|
||||
main(int v,char **V){ if (V[1]) {if(atoi(V[1])!=0) {
|
||||
q=0; O=r_; _d=V;
|
||||
x: (O)(); goto x; }}}
|
||||
main(int v,char **V){ O=r_; _d=V;
|
||||
x: (O)(); goto x; }
|
||||
@@ -1,8 +1,8 @@
|
||||
# Back to the Future Award
|
||||
|
||||
Yusuke Endoh
|
||||
<https://github.com/mame/>
|
||||
Twitter: @mametter
|
||||
Yusuke Endoh
|
||||
<https://github.com/mame/>
|
||||
Twitter: @mametter
|
||||
|
||||
## To build:
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ all: data ${TARGET}
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
@echo "NOTE: this entry will crash on no arg specified."
|
||||
${CC} ${CFLAGS} -DB=${B} -DI=${I} -DT=${T} -DS=${S} $< -o $@ ${LIBS}
|
||||
|
||||
${PROG}_le: ${PROG}.c
|
||||
|
||||
@@ -16,11 +16,7 @@ make
|
||||
./prog arg ...
|
||||
```
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this entry not
|
||||
segfault when no arg is specified though he notes that the author says it will
|
||||
segfault on zero args. He did NOT fix the strange results when more than one arg
|
||||
is specified. Thank you Cody for your assistance!
|
||||
|
||||
NOTE: this entry will crash on no arg specified.
|
||||
|
||||
## Try:
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
int main(int b,char**i){if(1[i]){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}}
|
||||
int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
|
||||
Reference in new issue
Block a user