using System; using System.Collections.Generic; public class Hello{ private static readonly Dictionary HAND_CODE_DICT = new Dictionary() { {"グー", 0}, {"チョキ", 1}, {"パー", 2}, }; private static readonly string[] HAND_LABELS = new string[] {"✊", "✌", "🖐"}; private static readonly string[] RESULT_LABELS = new string[] { "あいこ", "あなたの負け", "あなたの勝ち" }; private static int GetResult(int palyer_hand, int pc_hand) { int result = palyer_hand - pc_hand; // -3 < n < 3 result %= 3; // 0 < n < 6 result += 3; // 0 <= n < 3 result %= 3; return result; } public static void Main(){ // Your code here! System.Console.WriteLine("Hellow C#"); foreach(string player_hand in new string[]{"グー", "チョキ", "パー"}) { foreach(string pc_hand in new string[]{"グー", "チョキ", "パー"}) { int player_hand_code = HAND_CODE_DICT[player_hand]; int pc_hand_code = HAND_CODE_DICT[pc_hand]; int result_code = GetResult(player_hand_code, pc_hand_code); System.Console.WriteLine(string.Format("[{0} v.s. {1}] {2}", new object[] { HAND_LABELS[player_hand_code], HAND_LABELS[pc_hand_code], RESULT_LABELS[result_code], })); } } } }