結果

問題 No.1593 Perfect Distance
ユーザー hirakuhiraku
提出日時 2021-07-10 08:07:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 187 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 10,588 KB
実行使用メモリ 8,012 KB
最終ジャッジ日時 2023-09-14 18:39:58
合計ジャッジ時間 2,555 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
7,928 KB
testcase_01 AC 62 ms
7,908 KB
testcase_02 AC 62 ms
7,956 KB
testcase_03 AC 64 ms
7,976 KB
testcase_04 AC 62 ms
8,012 KB
testcase_05 AC 62 ms
7,892 KB
testcase_06 AC 69 ms
7,988 KB
testcase_07 AC 68 ms
7,992 KB
testcase_08 AC 65 ms
7,912 KB
testcase_09 AC 67 ms
7,896 KB
testcase_10 AC 71 ms
7,912 KB
testcase_11 AC 79 ms
7,884 KB
testcase_12 AC 90 ms
7,836 KB
testcase_13 AC 90 ms
7,912 KB
testcase_14 AC 94 ms
7,900 KB
testcase_15 AC 105 ms
7,988 KB
testcase_16 AC 115 ms
7,904 KB
testcase_17 AC 65 ms
7,932 KB
testcase_18 AC 61 ms
7,928 KB
testcase_19 AC 66 ms
7,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import isqrt

n = int(input())

ans = 0
for x in range(1, 2 * 10 ** 5 + 1):
  m = n ** 2 - x ** 2
  if m > 0:
    y = isqrt(m)
    if y ** 2 == m:
      ans += 1
    
print(ans)
0