using System; using System.Collections.Generic; class Program { static string InputPattern = "InputX"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("4"); //2 2 //2×2 = 4 です。この他の解は存在しません } else if (InputPattern == "Input2") { WillReturn.Add("18"); //6 3 //6×3 = 18 です。 //この他に {2,9}, {3,6}, {9,2} が考えられますが //どれを出力しても構いません。 } else if (InputPattern == "Input3") { WillReturn.Add("2"); //1 2 //1と2を使わずに2にする方法は存在しないので, //{1,2}, {2,1} のどちらかを出力します。 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); long M = long.Parse(InputList[0]); //偶数の場合 if (M % 2 == 0) { Console.WriteLine("{0} {1}", 2, M / 2); return; } for (long I = 3; I * I <= M; I += 2) { if (M % I == 0) { Console.WriteLine("{0} {1}", I, M / I); return; } } Console.WriteLine("{0} {1}", 1, M); } }