C♯の勉強

C♯4.0 で TopCoder の過去問を解きます。

2013-09-08から1日間の記事一覧

TopCoder SRM 590: FoxAndShogi

問題文各列の状態はそれぞれ独立しているので、各列ごとに状態数を求めてそれらを掛け合わせる。 列ごとの状態数については、上からコマを置いていって、「何番目のコマか」と「コマを置ける一番上の場所」で DP する。 public class FoxAndShogi { const in…

TopCoder SRM 590: FoxAndGo

問題文全探索。 public class FoxAndGo { static public int[] dx = { 0, 1, 0, -1 }; static public int[] dy = { 1, 0, -1, 0 }; public int FloodFill(char[][] board, int x, int y, ref bool existEmpty){ if(board[y][x] != 'o') return 0; board[y][x…

TopCoder SRM 590: FoxAndGomoku

問題文全探索 public class FoxAndGomoku { static public bool Between(long a, long x, long b) { return a <= x && x < b; } static public int[] dx = { 0, 1, 1, -1}; static public int[] dy = { 1, 0, 1, 1 }; public string win(string[] board) { i…