yohei #4502(2007/11/30 09:08 GMT) [ C# ] Rating0/0=0.00
再帰&yieldで n=50で204226件、3375 msでした。
Core2 Duo 6300 @ 1.86GHz, WinXP Pro, VS2005
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
using System; using System.Collections.Generic; class Program { static IEnumerable<string> Young2(int n, int m) { if (n <= m) yield return new string('□', n) + '\n'; for (int i = Math.Min(n - 1, m); i > 0; i--) foreach (string s in Young2(n - i, i)) yield return new string('□', i) + '\n' + s; } static IEnumerable<string> Young(int n) { return (n <= 0) ? new string[] {} : Young2(n, n); } static void Main(string[] args) { foreach (string s in Young(50)) Console.WriteLine(s); } }
Rating0/0=0.00-0+
[ reply ]
yohei
#4502()
[
C#
]
Rating0/0=0.00
再帰&yieldで n=50で204226件、3375 msでした。
Core2 Duo 6300 @ 1.86GHz, WinXP Pro, VS2005
Rating0/0=0.00-0+
[ reply ]