結果

問題 No.1593 Perfect Distance
ユーザー とりゐとりゐ
提出日時 2021-07-10 15:11:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 77,704 KB
最終ジャッジ日時 2023-09-14 19:30:08
合計ジャッジ時間 2,844 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,172 KB
testcase_01 AC 70 ms
71,256 KB
testcase_02 AC 68 ms
71,404 KB
testcase_03 AC 68 ms
71,252 KB
testcase_04 AC 71 ms
71,520 KB
testcase_05 AC 69 ms
71,516 KB
testcase_06 AC 70 ms
71,572 KB
testcase_07 AC 70 ms
71,660 KB
testcase_08 AC 77 ms
75,616 KB
testcase_09 AC 86 ms
76,508 KB
testcase_10 AC 85 ms
77,280 KB
testcase_11 AC 94 ms
77,704 KB
testcase_12 AC 97 ms
77,136 KB
testcase_13 AC 98 ms
77,168 KB
testcase_14 AC 99 ms
77,252 KB
testcase_15 AC 106 ms
77,476 KB
testcase_16 AC 110 ms
76,908 KB
testcase_17 AC 68 ms
71,396 KB
testcase_18 AC 66 ms
71,712 KB
testcase_19 AC 68 ms
71,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_square(n):
  if n<0:
    return False
  a=int(n**0.5)
  for i in range(max(0,a-1),a+2):
    if i**2==n:
      return True
  return False

n=int(input())
ans=0
for i in range(1,n):
  if is_square(n**2-i**2):
    ans+=1
print(ans)
0