結果

問題 No.1593 Perfect Distance
ユーザー bluemeganebluemegane
提出日時 2021-07-10 07:20:56
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 539 bytes
コンパイル時間 1,496 ms
コンパイル使用メモリ 60,872 KB
実行使用メモリ 26,320 KB
最終ジャッジ日時 2023-09-14 18:38:33
合計ジャッジ時間 6,936 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,592 KB
testcase_01 AC 55 ms
20,596 KB
testcase_02 AC 55 ms
22,688 KB
testcase_03 AC 55 ms
20,624 KB
testcase_04 AC 56 ms
20,652 KB
testcase_05 AC 55 ms
20,776 KB
testcase_06 AC 56 ms
18,644 KB
testcase_07 AC 56 ms
20,648 KB
testcase_08 AC 65 ms
22,740 KB
testcase_09 AC 923 ms
20,692 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        var n2 = n * n;
        getAns(n2);
    }
    static void getAns (long t)
    {
        var count = 0;
        for (long i = 1; i * i <= t; i++)
            for (long j = i; i *j<=t; j++)
            {
                if (i *i + j * j == t)
                {
                    if (i == j) count++;
                    else count += 2;
                }
            }
        Console.WriteLine(count);
    }
}
0