Format/typo check 1996/dalbec
Also since it was my proposed fix to the code (for clang) I decided to change the function name to how I've been doing it: rather than 'cain()' it is now 'pain()'.
This commit is contained in:
1 parent
a728375f14
commit
04889c6384
3 files changed
+21
-20
No files matched your search
@@ -66,9 +66,7 @@ where `a==0`.
|
||||
4. The fact that `main()` is a single expression and so beautifies poorly.
|
||||
|
||||
5. The fact that `main()` is used:
|
||||
|
||||
- to compute powers in modular arithmetic.
|
||||
|
||||
- to recursively call itself in the main loop.
|
||||
|
||||
|
||||
|
||||
+11
-11
@@ -1,16 +1,16 @@
|
||||
int cain(int I, char **O, int O0, int OO, int l)
|
||||
int pain(int I, char **O, int O0, int OO, int l)
|
||||
{
|
||||
return !!I>=I?!I>=I?!!~I>=~I?!~I>=~I?!OO?!I:OO%2?
|
||||
OO=cain(I,O,O0,OO>>!!OO,l),
|
||||
OO=cain(I-!I-!!I,O,OO,OO,l),
|
||||
OO=cain(I-!I-!!I,O,O0,OO,l),
|
||||
OO=pain(I,O,O0,OO>>!!OO,l),
|
||||
OO=pain(I-!I-!!I,O,OO,OO,l),
|
||||
OO=pain(I-!I-!!I,O,O0,OO,l),
|
||||
!(OO-!I||I)?l-1:OO
|
||||
:(OO=cain(I,O,O0,OO>>!!OO,l),
|
||||
!(OO-l+!I||I)?l-1:cain(I-!I-!!I,O,OO,OO,l))
|
||||
:(OO=pain(I,O,O0,OO>>!!OO,l),
|
||||
!(OO-l+!I||I)?l-1:pain(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\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]));
|
||||
:pain(I-I/I-I/I,O,O0,OO+OO/OO,
|
||||
pain(0,O,O0,OO,I-I-I)+I+1?1:printf("%d\n",I-I-I)+fflush(stdout))
|
||||
:pain(I-I-I-I-I,O,I+I-I+I,I,0)
|
||||
:pain(~!!I-!!I,O,atoi(1[O]),1,atoi(0[O]));
|
||||
}
|
||||
int main(int I, char **O) { int O0=0,OO=0,l=0; return cain(I,O,O0,OO,l); }
|
||||
int main(int I, char **O) { int O0=0,OO=0,l=0; return pain(I,O,O0,OO,l); }
|
||||
+10
-7
@@ -1934,15 +1934,18 @@ commands.
|
||||
## [1996/dalbec](1996/dalbec/dalbec.c) ([README.md](1996/dalbec/README.md]))
|
||||
|
||||
Cody 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's] analysis found
|
||||
after some discussion (though Cody changed the function name). 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's
|
||||
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. This was not put in an alternate version but
|
||||
perhaps it should be.
|
||||
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. This was not put in an alternate version but perhaps
|
||||
it should be.
|
||||
|
||||
|
||||
## [1996/eldby](1996/eldby/eldby.c) ([README.md](1996/eldby/README.md]))
|
||||
|
||||
Reference in new issue
Block a user