Created
June 14, 2012 10:48
-
-
Save azyobuzin/2929574 to your computer and use it in GitHub Desktop.
Buzzになる数字をFizzBuzz判断を使わずにn個挙げる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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