結果

問題 No.1593 Perfect Distance
ユーザー reatoretchreatoretch
提出日時 2021-07-09 22:11:14
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2023-09-14 09:19:29
合計ジャッジ時間 3,319 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,288 KB
testcase_01 AC 72 ms
71,220 KB
testcase_02 AC 72 ms
70,956 KB
testcase_03 AC 71 ms
71,472 KB
testcase_04 AC 73 ms
71,096 KB
testcase_05 AC 73 ms
71,372 KB
testcase_06 AC 72 ms
71,472 KB
testcase_07 AC 80 ms
75,752 KB
testcase_08 AC 89 ms
75,808 KB
testcase_09 AC 100 ms
76,608 KB
testcase_10 AC 102 ms
76,480 KB
testcase_11 AC 106 ms
76,872 KB
testcase_12 AC 114 ms
76,596 KB
testcase_13 AC 116 ms
76,652 KB
testcase_14 AC 121 ms
76,624 KB
testcase_15 AC 134 ms
76,928 KB
testcase_16 AC 146 ms
76,632 KB
testcase_17 AC 74 ms
71,392 KB
testcase_18 AC 75 ms
71,320 KB
testcase_19 AC 76 ms
71,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def X(mid):
    global N
    return N*N-mid*mid
def bsL(target,left,right):
  while True:
    mid=(left+right)//2
    mid2=X(mid)
    if mid2==target:
      return 1
    if right-left==1:
      return 0
    if mid2>target:
      left=mid
    else:
      right=mid
N=int(input())
ans=0
for x in range(N):
    ans+=bsL(x*x,0,N)
print(ans)
0