Further fix 1996/dalbec

I made the recommended change by the author so that each number is on a
line by itself rather than one long line. I changed the try section to
stop at the output that was the output noted by the judges. This was
possible with the change of making it a newline rather than a space
after each number.

I had originally proposed the change in commit
9b6b5a0376 but I did not implement it
because the output of the command versus what the try section included
was misleading (maybe that was correct :-) ) and when looking at Yusuke
Endoh's output I missed that it continued after the number (he had '...'
but I missed it in the long line of output). I linked to his analysis as
well. Thank you Yusuke for confirming it is correct output!
This commit is contained in:
Cody Boone Ferguson committed 2023-03-20 05:47:21 -07:00
1 parent f86ab4571f
commit 674a05e15e
2 files changed
+16 -4

No files matched your search

+15 -3
View File
@@ -11,7 +11,19 @@
make all
NOTE: This entry uses non-standard args to main() that do not work with modern compilers.
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) proposed a fix for this
to compile with clang and Landon implemented it after some discussion. The
reason Cody did not do it is because he thought it was the wrong output but as
it happens the try section below was worded a bit confusingly. He looked at
[Yusuke Endoh's](/winners.html#Yusuke_Endoh) analysis found
[here](https://mame-github-io.translate.goog/ioccc-ja-spoilers/1996/dalbec.html?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp)
but he missed that Yusuke added a '...' after the result which made him think
the fix was wrong. Cody also made the recommended change of the author to make
it so that each number is printed on a line by itself rather than having a long
string of numbers on the same line. Thank you Cody for your assistance and
thanks to Yusuke for confirming the output is correct!
## To run:
@@ -20,9 +32,9 @@ NOTE: This entry uses non-standard args to main() that do not work with modern c
## Try:
./dalbec 3
./dalbec 3 | head -n 29
Why does it output 121?
Why does the output end with 121?
## Judges' comments:
+1 -1
View File
@@ -9,7 +9,7 @@ int cain(int I, char **O, int O0, int OO, int l)
!(OO-l+!I||I)?l-1:cain(I-!I-!!I,O,OO,OO,l))
:(O0+OO)%l
:cain(I-I/I-I/I,O,O0,OO+OO/OO,
cain(0,O,O0,OO,I-I-I)+I+1?1:printf("%d ",I-I-I)+fflush(stdout))
cain(0,O,O0,OO,I-I-I)+I+1?1:printf("%d\n",I-I-I)+fflush(stdout))
:cain(I-I-I-I-I,O,I+I-I+I,I,0)
:cain(~!!I-!!I,O,atoi(1[O]),1,atoi(0[O]));
}