using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "Input3"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("1 2 2 2"); //YES } else if (InputPattern == "Input2") { WillReturn.Add("1 2 2 1"); //NO } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } //No.166 マス埋めゲーム static void Main() { List InputList = GetInputList(); int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray(); int H = wkArr[0]; int W = wkArr[1]; int N = wkArr[2]; int K = wkArr[3]; int MasuCnt = H * W; int ModVal = MasuCnt % N; int LastNo = (ModVal == 0 ? N : ModVal); Console.WriteLine(LastNo == K ? "YES" : "NO"); } }