結果

問題 No.1593 Perfect Distance
ユーザー 👑 tamatotamato
提出日時 2021-07-09 21:22:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 87,528 KB
実行使用メモリ 77,096 KB
最終ジャッジ日時 2023-09-14 07:26:48
合計ジャッジ時間 3,171 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,928 KB
testcase_01 AC 72 ms
71,800 KB
testcase_02 AC 72 ms
71,364 KB
testcase_03 AC 73 ms
71,972 KB
testcase_04 AC 74 ms
71,884 KB
testcase_05 AC 72 ms
71,644 KB
testcase_06 AC 73 ms
71,968 KB
testcase_07 AC 72 ms
71,532 KB
testcase_08 AC 78 ms
76,496 KB
testcase_09 AC 77 ms
76,492 KB
testcase_10 AC 76 ms
76,316 KB
testcase_11 AC 79 ms
76,316 KB
testcase_12 AC 79 ms
76,472 KB
testcase_13 AC 79 ms
76,476 KB
testcase_14 AC 79 ms
76,492 KB
testcase_15 AC 83 ms
77,096 KB
testcase_16 AC 86 ms
76,876 KB
testcase_17 AC 73 ms
71,440 KB
testcase_18 AC 76 ms
71,644 KB
testcase_19 AC 72 ms
71,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from math import floor, sqrt
    input = sys.stdin.readline

    N = int(input())
    ans = 0
    for x in range(1, N):
        y = floor(sqrt(N**2 - x**2))
        for yy in range(y-1, y+2):
            if x**2 + yy**2 == N**2:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()
0