2014-07-13から1日間の記事一覧

Project Euler 31

C# PE

Problem 31 動的計画法の基本的な問題。 using System; class PE031 { static void Main() { int[] coins = { 1, 2, 5, 10, 20, 50, 100, 200 }; const int N = 200; int[] dp = new int[N+1]; dp[0] = 1; for (int i = 0; i < coins.Length; i++) { for (in…

構造体の練習

C#

using System; struct St { public int x; } class Cl { public int x; } class Test { static void Foo(St st, Cl cl) { st.x = cl.x = 2; } static void Bar(ref St st, Cl cl) { st.x = cl.x = 3; } static void Main() { var st = new St(); var cl = ne…