結果
問題 | No.414 衝動 |
ユーザー |
![]() |
提出日時 | 2024-10-13 08:02:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 29 ms / 1,000 ms |
コード長 | 1,542 bytes |
コンパイル時間 | 895 ms |
コンパイル使用メモリ | 111,116 KB |
実行使用メモリ | 25,816 KB |
最終ジャッジ日時 | 2024-10-13 08:02:50 |
合計ジャッジ時間 | 2,042 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Collections.Generic;class Program{static string InputPattern = "InputX";static List<string> GetInputList(){var WillReturn = new List<string>();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<string> 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);}}