This file contains 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
// using System; | |
// using System.Collections.Generic; | |
// using System.Linq; | |
public static class BinarySearch | |
{ | |
/// <summary> | |
/// 指定された範囲の中央位置を取得します。小数点以下は切り上げます。 | |
/// </summary> | |
private static int GetCenterIndex(int start, int last) |
This file contains 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
// using System.Collections.Generic; | |
public static class CharacterArt | |
{ | |
public static IEnumerable<Item> Diamond(int size) | |
{ | |
for (int i = 0; i < size; i++) | |
{ | |
yield return new Item | |
{ |
This file contains 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
using System; | |
using System.Collections.Generic; | |
namespace RQN | |
{ | |
public static class RepeatedPermutation | |
{ | |
/// <summary> | |
/// 指定した文字を使用して、指定した長さの重複順列を生成します。 | |
/// </summary> |
This file contains 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
// using System; | |
// using System.Security.Cryptography; | |
public static class Random | |
{ | |
/// <summary> | |
/// 指定された最大値より小さい 0 以上のランダムな整数を返します。 | |
/// </summary> | |
public static int GetRandomNumber(int maxValue = int.MaxValue) | |
{ |
This file contains 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
// using System.Collections.Generic; | |
static IEnumerable<string> Generate(string[] keyword, int length) | |
{ | |
if (length > 1) | |
{ | |
foreach (var key in keyword) | |
{ | |
foreach (var key2 in Generate(keyword, length - 1)) | |
{ |