Skip to content

Instantly share code, notes, and snippets.

@azyobuzin
Created June 14, 2012 10:48
Show Gist options
  • Save azyobuzin/2929574 to your computer and use it in GitHub Desktop.
Save azyobuzin/2929574 to your computer and use it in GitHub Desktop.
Buzzになる数字をFizzBuzz判断を使わずにn個挙げる
//n個
var n = 5;
var result = Enumerable.Range(0, (int)Math.Ceiling(n / 2D))
.SelectMany(count => (count == Math.Floor(n / 2D) && n % 2 != 0
? new[] { 5 } : new[] { 5, 10 })
.Select(i => 15 * count + i));
//LINQPadに出力
result.Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment