結果

問題 No.1593 Perfect Distance
ユーザー tobusakanatobusakana
提出日時 2021-07-10 01:11:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 90,204 KB
最終ジャッジ日時 2023-09-14 12:40:10
合計ジャッジ時間 3,278 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,424 KB
testcase_01 AC 73 ms
71,140 KB
testcase_02 AC 74 ms
71,456 KB
testcase_03 AC 73 ms
71,392 KB
testcase_04 AC 73 ms
71,404 KB
testcase_05 AC 74 ms
71,056 KB
testcase_06 AC 74 ms
71,520 KB
testcase_07 AC 75 ms
71,320 KB
testcase_08 AC 76 ms
71,532 KB
testcase_09 AC 88 ms
76,260 KB
testcase_10 AC 87 ms
77,292 KB
testcase_11 AC 91 ms
78,644 KB
testcase_12 AC 91 ms
81,028 KB
testcase_13 AC 94 ms
81,216 KB
testcase_14 AC 95 ms
82,720 KB
testcase_15 AC 98 ms
85,752 KB
testcase_16 AC 100 ms
90,204 KB
testcase_17 AC 76 ms
71,068 KB
testcase_18 AC 75 ms
71,268 KB
testcase_19 AC 74 ms
71,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
N *= N

candi = []

num = 1
while num ** 2 <= N:
  candi += [num ** 2]
  num += 1
  
back = len(candi) - 1

ans = 0
for front in range(len(candi)):
  while candi[front] + candi[back] > N:
    back -= 1
    if back == -1:
      print(ans)
      exit(0)
  if candi[front] + candi[back] == N:
    ans += 1
print(ans)
0