Skip to content

Instantly share code, notes, and snippets.

@ntddk
Last active December 3, 2021 06:58
Show Gist options
  • Save ntddk/7678ed6349a66e279843 to your computer and use it in GitHub Desktop.
Save ntddk/7678ed6349a66e279843 to your computer and use it in GitHub Desktop.
code golf
// お題
// http://togetter.com/li/92612
// FizzBuzzを30バイトで
// my code
// 1.
//main(_){printf(_%15?_%3?_%5?"%d\n":"Buzz\n":"Fizz\n":"FizzBuzz\n",_);main(++_);}
// 80bytes
// 2.
main(_){printf(_%3?_%5?"%d":0:"Fizz",_);puts(_%5?"":"Buzz");main(++_);}
// 71bytes
// これは「1から100」までという縛りなし.
// 縛りありだと_++-100&&main(_)で伸びちゃうな.
// 例
// 1.
// http://gsbina.com/?p=281
// main(a){for(;a<101;puts(a++%5?"":"Buzz"))printf(a%3?a%5?"%d":0:"Fizz",a);}
// 75bytes
// 2.
// http://golf.shinh.org/p.rb?FizzBuzz#C
// 最短は73bytesっぽい.マジかよ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment