結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,288 KB
testcase_01 AC 72 ms
71,688 KB
testcase_02 AC 71 ms
71,616 KB
testcase_03 AC 73 ms
71,620 KB
testcase_04 AC 72 ms
71,820 KB
testcase_05 AC 72 ms
71,772 KB
testcase_06 AC 72 ms
71,436 KB
testcase_07 AC 74 ms
71,624 KB
testcase_08 AC 78 ms
75,540 KB
testcase_09 AC 88 ms
77,092 KB
testcase_10 AC 87 ms
77,244 KB
testcase_11 AC 98 ms
77,668 KB
testcase_12 AC 103 ms
77,336 KB
testcase_13 AC 103 ms
77,412 KB
testcase_14 AC 104 ms
77,236 KB
testcase_15 AC 113 ms
77,444 KB
testcase_16 AC 118 ms
77,324 KB
testcase_17 AC 74 ms
71,432 KB
testcase_18 AC 71 ms
71,712 KB
testcase_19 AC 71 ms
71,696 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