結果

問題 No.300 平方数
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-08-16 10:59:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 73 ms / 1,000 ms
コード長 821 bytes
コンパイル時間 2,318 ms
コンパイル使用メモリ 102,452 KB
実行使用メモリ 23,644 KB
最終ジャッジ日時 2023-08-16 10:59:35
合計ジャッジ時間 7,645 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
19,452 KB
testcase_01 AC 59 ms
23,644 KB
testcase_02 AC 66 ms
19,576 KB
testcase_03 AC 57 ms
19,432 KB
testcase_04 AC 56 ms
19,484 KB
testcase_05 AC 56 ms
21,552 KB
testcase_06 AC 56 ms
21,444 KB
testcase_07 AC 57 ms
21,548 KB
testcase_08 AC 56 ms
19,484 KB
testcase_09 AC 56 ms
19,476 KB
testcase_10 AC 56 ms
21,464 KB
testcase_11 AC 55 ms
21,548 KB
testcase_12 AC 56 ms
23,548 KB
testcase_13 AC 73 ms
23,528 KB
testcase_14 AC 60 ms
21,456 KB
testcase_15 AC 65 ms
21,452 KB
testcase_16 AC 66 ms
21,420 KB
testcase_17 AC 72 ms
21,760 KB
testcase_18 AC 59 ms
21,396 KB
testcase_19 AC 62 ms
21,512 KB
testcase_20 AC 60 ms
19,472 KB
testcase_21 AC 71 ms
21,556 KB
testcase_22 AC 70 ms
21,708 KB
testcase_23 AC 69 ms
23,480 KB
testcase_24 AC 65 ms
21,572 KB
testcase_25 AC 68 ms
19,432 KB
testcase_26 AC 67 ms
21,448 KB
testcase_27 AC 66 ms
21,536 KB
testcase_28 AC 68 ms
23,488 KB
testcase_29 AC 69 ms
21,436 KB
testcase_30 AC 69 ms
21,412 KB
testcase_31 AC 71 ms
21,632 KB
testcase_32 AC 66 ms
21,532 KB
testcase_33 AC 61 ms
19,492 KB
testcase_34 AC 70 ms
21,540 KB
testcase_35 AC 65 ms
21,560 KB
testcase_36 AC 72 ms
21,448 KB
testcase_37 AC 66 ms
21,540 KB
testcase_38 AC 68 ms
21,600 KB
testcase_39 AC 69 ms
23,548 KB
testcase_40 AC 67 ms
21,448 KB
testcase_41 AC 61 ms
23,508 KB
testcase_42 AC 64 ms
21,348 KB
testcase_43 AC 69 ms
21,444 KB
testcase_44 AC 65 ms
21,600 KB
testcase_45 AC 62 ms
21,636 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Linq;

namespace yukicoder
{
    public class Program
    {
        public static void Main()
        {
            var x = long.Parse(Console.ReadLine());
            var k = PF(x);
            Console.WriteLine(k.Aggregate((x, y) => x * y));
        }
        public static List<long> PF(long x)
        {
            var k = new List<long>();
            var n = Math.Sqrt(x);
            for (var i = 2; i <= n; i++)
            {
                var j = 0;
                while (x % i == 0)
                {
                    j++;
                    x /= i;
                }
                if (j % 2 == 1)
                {
                    k.Add(i);
                }
            }
            k.Add(x);
            return k;
        }
    }
}
0