結果

問題 No.300 平方数
ユーザー mban
提出日時 2017-01-01 23:04:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 737 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 109,620 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-12-16 05:31:57
合計ジャッジ時間 3,207 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatro
{
    static void Main()
    {
        long X = long.Parse(Console.ReadLine());
        long ans = 1;
        for(int i = 2; i <= Math.Sqrt(X); i++)
        {
            if (X % i == 0)
            {
                int c = 0;
                while (X % i == 0)
                {
                    c++;
                    X /= i;
                }
                if (c % 2 == 1)
                {
                    ans *= i;
                }
            }
        }
        ans *= X;
        Console.WriteLine(ans);
    }
}

0