Make 2000/anderson use fgets() not gets()

I tried to keep the format similar to the original. The only difference
is that there are more lines now.
This commit is contained in:
Cody Boone Ferguson committed 2023-03-22 10:20:35 -07:00
1 parent 601596d1be
commit 2946cf1982
2 files changed
+12 -8

No files matched your search

+3 -2
View File
@@ -12,8 +12,9 @@ Indonesia
make
```
NOTE: this entry uses `gets()` so you will likely get a warning when compiling
and/or executing this program.
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) changed this entry to
use `fgets()` instead of `gets()` to make it safer. Thank you Cody!
### To run:
+9 -6
View File
@@ -25,12 +25,15 @@ j((r[2]=0,R( ))
),r[1]-=q) &&
O(g-=-q) ;}
C(){( J=
gets (K
[1]))&&C((B(g=K[2]),*r=!(!*r&&(*g++=0)),(*r)[r]=g-K[2],g=K[2
],r[
1]&&
O())
);;}
fgets (K
[1],1000,stdin))&&C((B(g=K[2]),*r=!(!*r&&(*g++=0)),(*r)[r]=g
-K[2
],g=
K[2]
,r[1
]&&O
()))
;;}
main
(){C
((l(