結果

問題 No.300 平方数
ユーザー aketijyuuzou
提出日時 2024-10-13 00:05:07
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 36 ms / 1,000 ms
コード長 1,078 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 110,956 KB
実行使用メモリ 26,132 KB
最終ジャッジ日時 2024-10-13 00:05:11
合計ジャッジ時間 3,443 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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");
            //1
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("8");
            //2
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("459431198626");
            //114514
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        long X = long.Parse(InputList[0]);

        //平方数の倍数なら、その平方数で割る
        for (long I = 2; I * I <= X; I++) {
            long wkHeihouSuu = I * I;
            while (X % wkHeihouSuu == 0)
                X /= wkHeihouSuu;
        }
        Console.WriteLine(X);
    }
}

0