|
|
back to boardC# Solution Posted by zak427 14 Jun 2016 00:06 using System; namespace CSharp_1197 { public class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); string str2 = ""; for (int i = 1; i <= n; i++) { string str1 = Console.ReadLine(); if (str1 == "a1" || str1 == "h1" || str1 == "a8" || str1 == "h8") str2 = str2 + 2 + " "; else if(str1 == "b1" || str1 == "g1" || str1 == "b8" || str1 == "g8" || str1 == "a2" || str1 == "h2" || str1 == "a7" || str1 == "h7") str2 = str2 + 3 + " "; else if(str1 == "b2" || str1 == "g2" || str1 == "b7" || str1 == "g7" || str1 == "a3" || str1 == "h3" || str1 == "a6" || str1 == "h6" || str1 == "c1" || str1 == "f1" || str1 == "d1" || str1 == "e1" || str1 == "c8" || str1 == "f8" || str1 == "d8" || str1 == "e8" || str1 == "a4" || str1 == "h4" || str1 == "a5" || str1 == "h5") str2 = str2 + 4 + " "; else if (str1 == "b3" || str1 == "g3" || str1 == "b6" || str1 == "g6" || str1 == "c2" || str1 == "f2" || str1 == "d2" || str1 == "e2" || str1 == "c7" || str1 == "f7" || str1 == "d7" || str1 == "e7" || str1 == "b4" || str1 == "g4" || str1 == "b5" || str1 == "g5") str2 = str2 + 6 + " "; else str2 = str2 + 8 + " "; } Console.WriteLine(str2); } } } |
|
|