結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
22,636 KB
testcase_01 AC 56 ms
20,636 KB
testcase_02 AC 56 ms
22,716 KB
testcase_03 AC 55 ms
22,688 KB
testcase_04 AC 55 ms
20,608 KB
testcase_05 AC 55 ms
22,696 KB
testcase_06 AC 55 ms
20,652 KB
testcase_07 AC 55 ms
22,732 KB
testcase_08 AC 54 ms
20,628 KB
testcase_09 AC 55 ms
20,740 KB
testcase_10 AC 55 ms
20,664 KB
testcase_11 AC 54 ms
20,668 KB
testcase_12 AC 56 ms
22,688 KB
testcase_13 AC 55 ms
18,584 KB
testcase_14 AC 56 ms
20,692 KB
testcase_15 AC 57 ms
20,760 KB
testcase_16 AC 58 ms
20,660 KB
testcase_17 AC 55 ms
20,752 KB
testcase_18 AC 55 ms
20,704 KB
testcase_19 AC 55 ms
20,672 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));
            if (s != 0 && i * i + s * s == t) count++;
        }
        Console.WriteLine(count);
    }
}
0