2014-05-11から1日間の記事一覧

多次元配列、ジャグ配列を foreach で回す

using System; public class TestArray { public static void Main() { int[,] xs = new int[,] { { 1, 2 }, { 3, 4 } }; foreach (int x in xs) { Console.Write("{0} ", x); } Console.WriteLine(); int[][] ys = new int[2][]; ys[0] = new int[] { 10, 2…

Project Euler 15

PE

Problem 15 2 次元配列の練習。 20x20 なので 40 ステップで目的値に到達する。そのうち、水平移動は 20 ステップ行うので、40C20 を計算する方法でも良い。 『組み合わせ入門』p.2 using System; class PE015 { public static void Main() { const int N = …