@Plopx
36!
I thought it was impossible.
Congratulation, I bow.
I really do wish there were language ratings. I managed to create an 80 character C solution, and I want to see where I stack up.
It is possible. On all our leaderboards you can click on the header to filter. Just click on the language header and select C to show only the solutions in C.
@MaximeC Yes, but this feature might be improved. The language leaderboard shows the global ranking instead of the one in selected language. So if youâre not in top 10, itâs not that easy to tell your ranking.
Best sum up ever. With that and system fully forbidden, code golf will be finally a lot of fun.
ok, I found.
I have one, use a Windows machine to run all the tests: no more bash \o/
The solutions below 35 characters are impressive! I wonder if there is an algorithmic trick that I didnât found for now, or if the solutions are hardcoded, despite the hidden test cases.
@abouvier @6pi @Origraena
About mine, itâs not an hardcoded one. Have fun
Thank you for your answer. I keep searchingâŚ
I return the question to you, your solution below 32 in Perl are hardcoded one or not?
None of my solutions is hardcoded.
Iâm still looking for (at least) 3 chars to shave offâŚ
I canât believe you are doing this in 36 characters in C. Do you really solve the problem as it is stated on any possible input (not just on the test and validator cases)? I mean, âmain(a){scanf(â%d",&a);printf("%d",a);}" is already 39 chars⌠My solution is currently 93 chars, and I can believe I missed something, but I canât believe it is feasible under less than 80 chars.
As stated above, system() is shorter than scanf()+printf(). Then there is another dirty trick to reduce it a bit more.
Thank you for your answer; indeed, I saw this after posting my questionâŚ
I agree with you and others: system() should be forbidden for these puzzles.
Still, 36 chars is impressive, and I wonder what utility you use.
Iâve made in plain C (scanf & printf, no hacking, not hardcoded) using 71 characters. Has anyone a smaller solution ?
Any tips for Perl? I see the shortest solution has 26 characters. I imagine one needs at least two "<>"s, a âprintâ and a âsplit/ /â, which gives 17 characters, leaving only 9 for the rest of the solution? This seems incredible. I wonder what Iâm doing wrong
The âsplit/ /â could perhaps be changed for some smart regex, but I really canât see how
âsayâ doesnât shorten the print much as it only works as CORE::say or with a âuse v5.10â line, all of which make it longer if you donât print the trailing â\nâ (which you donât have to in this puzzle)âŚ
Learning how to shorten these things would help me a lot when solving other puzzles so any feedback would be greatly appreciated
Validator12 still failed⌠Seriously, I do not know what I am doing wrongâŚ
Same for me. The 12th test case always fails. I havenât hard coded any numbers in my code.
do you handle -0, 0 in the list ?