結果

問題 No.1593 Perfect Distance
ユーザー Tomii9273Tomii9273
提出日時 2021-07-10 03:26:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 77,084 KB
最終ジャッジ日時 2023-09-14 15:34:15
合計ジャッジ時間 3,407 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,416 KB
testcase_01 AC 74 ms
71,688 KB
testcase_02 AC 74 ms
71,736 KB
testcase_03 AC 74 ms
71,932 KB
testcase_04 AC 74 ms
71,868 KB
testcase_05 AC 76 ms
71,728 KB
testcase_06 AC 77 ms
71,840 KB
testcase_07 AC 74 ms
71,628 KB
testcase_08 AC 81 ms
76,704 KB
testcase_09 AC 86 ms
77,036 KB
testcase_10 AC 89 ms
77,084 KB
testcase_11 AC 89 ms
77,008 KB
testcase_12 AC 95 ms
76,772 KB
testcase_13 AC 98 ms
76,888 KB
testcase_14 AC 97 ms
76,988 KB
testcase_15 AC 105 ms
76,996 KB
testcase_16 AC 105 ms
76,868 KB
testcase_17 AC 76 ms
71,760 KB
testcase_18 AC 75 ms
71,564 KB
testcase_19 AC 77 ms
71,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
# sys.setrecursionlimit(10 ** 9)  # Codeforcesでは350000程度に
def input(): return sys.stdin.readline().strip()


n = int(input())

ans = 0
n2 = n**2
for x in range(1, n):
    y_can_2 = n**2 - x**2
    y_can = int(y_can_2**0.5)
    for y in range(y_can-1, y_can+2):
        if y > 0 and y**2 == y_can_2:
            ans += 1
            break
print(ans)
0