結果

問題 No.1593 Perfect Distance
ユーザー bluemeganebluemegane
提出日時 2021-07-10 07:53:12
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 63,124 KB
実行使用メモリ 22,732 KB
最終ジャッジ日時 2023-09-14 18:39:25
合計ジャッジ時間 2,846 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
22,596 KB
testcase_01 AC 56 ms
20,544 KB
testcase_02 AC 55 ms
18,644 KB
testcase_03 AC 54 ms
20,608 KB
testcase_04 AC 55 ms
20,676 KB
testcase_05 AC 56 ms
18,644 KB
testcase_06 AC 54 ms
22,660 KB
testcase_07 AC 54 ms
18,688 KB
testcase_08 AC 54 ms
20,696 KB
testcase_09 AC 55 ms
20,680 KB
testcase_10 AC 55 ms
20,616 KB
testcase_11 AC 54 ms
18,628 KB
testcase_12 AC 55 ms
18,628 KB
testcase_13 AC 56 ms
22,708 KB
testcase_14 AC 56 ms
20,556 KB
testcase_15 AC 57 ms
20,644 KB
testcase_16 AC 58 ms
22,648 KB
testcase_17 AC 55 ms
20,700 KB
testcase_18 AC 56 ms
22,732 KB
testcase_19 AC 54 ms
20,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
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++)
        {
            var s = (long)(Sqrt(t - i * i) + 1.0e-8);
            if (s != 0 && i * i + s * s == t) count++;
        }
        Console.WriteLine(count);
    }
}
0