Last active
May 17, 2020 02:47
-
-
Save webuilder240/0d71b367134e9d85dbfacd1194f009e4 to your computer and use it in GitHub Desktop.
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
// https://twitter.com/i4mwh4ti4m/status/1258768719972454400?s=21 | |
// しすすすすしおおおすし | |
// 11文字目でおすしがでました | |
using System; | |
using System.Collections.Generic; | |
namespace _3charsCharenge | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var result = ""; | |
var rand = new Random(); | |
List<string> l = new List<string>(){"お", "す" ,"し"}; | |
var expect = string.Join("", l); | |
while(true) | |
{ | |
var c = l[rand.Next(0, 3)]; | |
result += c; | |
if (result.Contains(expect)) | |
{ | |
break; | |
} | |
} | |
Console.WriteLine(result); | |
Console.WriteLine($"{result.Length}文字目で{expect}がでました"); | |
} | |
} | |
} |
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
// https://twitter.com/i4mwh4ti4m/status/1258768719972454400?s=21 | |
// しすすすすしおおおすし | |
// 11文字目でおすしがでました | |
using System; | |
using System.Collections.Generic; | |
namespace _3charsCharenge | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var result = ""; | |
var rand = new Random(); | |
List<string> l = new List<string>(){"お", "す" ,"し"}; | |
var expect = string.Join("", l); | |
do | |
{ | |
result += l[rand.Next(0, 3)]; | |
} while (!result.Contains(expect)); | |
Console.WriteLine(result); | |
Console.WriteLine($"{result.Length}文字目で{expect}がでました"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment