using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { this.N = int.Parse(Reader.ReadLine()); bool[][] map = new bool[this.N][]; for (int i = 0; i < this.N; i++) { map[i] = Reader.ReadLine().Select(a => a == '.').ToArray(); } int ans = GetAns(0, map, GetKey(0, map)); Console.WriteLine(ans); } private Dictionary dic = new Dictionary(); private int GetAns(int idx, bool[][] map, string key) { if(idx>=this.N*this.N) { return 0; } int r = idx / this.N; int c = idx % this.N; if(!map[r][c]) { return GetAns(idx + 1, map, key.Substring(1)); } if(dic.ContainsKey(key)) { return dic[key]; } int ans = 0; if(r+(this.N-1) string.Join("", a.Select(b => b ? "1" : "0")))); return ret.Substring(idx); } private int N; public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 5 #.#.# ..... #.#.# #.#.# ..... "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }