6 ms·
My best C solution (scores a 96): #define d printf( main(i){i<101?(!(i%3)?d"Fizz"):0)|(!(i%5)?d"Buzz"):0)?d"\n"):d"%d\n",i),main(i+1):0;}
by nappy-doo 14y ago
My best C solution (scores a 96):
#define d printf(
main(i){i<101?(!(i%3)?d"Fizz"):0)|(!(i%5)?d"Buzz"):0)?d"\n"):d"%d\n",i),main(i+1):0;}
- wickberg 14y agoI was working on the same lines, and managed to bump it up to a score of 106: #define P printf( main(n){(n%3?0:P"Fizz"))+(n%5?0:P"Buzz"))?:P"%d",n);P"\n");n>99?:main(n+1);}
- loumf 14y agoyou can get rid of the !() if you reverse the ?: #define d printf( main(i){i<101?(i%3?0:d"Fizz"))|(i%5?0:d"Buzz"))?d"\n"):d"%d\n",i),main(i+1):0;}
- nappy-doo 14y agoexcellent, missed that. :)