Merge pull request #59 from xexyl/holloway

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-03-14 14:42:21 -07:00
commit 3168b307b3
2 files changed
+14 -7

No files matched your search

+10 -4
View File
@@ -10,10 +10,16 @@ USA
make all make all
NOTE: we could not compile this entry under modern macOS but it will work NOTE: Cody Boone Ferguson fixed this to compile with clang (it worked with gcc).
fine under linux. It likely fails to compile under macOS because its gcc is The problem was that clang is more strict about the type of second arg to
actually just clang which is more strict about the type of the second main(). However simply changing it to a `char **` and updating the `*s` to `**s`
argument of main(). If you have gcc under macOS it might work just as well. caused a segfault. By adding a new variable, `char *t`, initialising it to `s`
and then using `t` instead of `s` it compiles and runs successfully under clang
and gcc. Thank you Cody for your assistance!
## Try:
./holloway
## Judges' comments: ## Judges' comments:
+4 -3
View File
@@ -11,7 +11,8 @@
long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L }; long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 }; int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };
main(m1,s) char *s; { main(m1,s) char **s; {
char *t = s;
int a,b,c,d,o[k],n=(int)s; int a,b,c,d,o[k],n=(int)s;
if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); } if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); }
else switch(m1-=h){ else switch(m1-=h){
@@ -27,7 +28,7 @@ main(m1,s) char *s; {
if((b=n)>=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c; if((b=n)>=e)for(b=g<<g;b<n;++b)o[b]=o[b-h]+o[b-g]+c;
return(o[b-g]%n+k-h); return(o[b-g]%n+k-h);
default: default:
if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f; if(m1-=e) main(m1-g+e+h,t+g); else *(t+g)=f;
for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1); for(*t=a=f;a<e;) *t=(*t<<e)|main(h+a++,(char *)m1);
} }
} }