結果

問題 No.1593 Perfect Distance
ユーザー reatoretchreatoretch
提出日時 2021-07-09 22:11:14
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 950 ms
使用メモリ 81,352 KB
最終ジャッジ日時 2023-02-01 23:50:20
合計ジャッジ時間 3,366 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 76 ms
75,688 KB
testcase_01 AC 76 ms
75,552 KB
testcase_02 AC 73 ms
75,900 KB
testcase_03 AC 74 ms
75,820 KB
testcase_04 AC 75 ms
75,880 KB
testcase_05 AC 74 ms
75,852 KB
testcase_06 AC 75 ms
75,704 KB
testcase_07 AC 81 ms
80,236 KB
testcase_08 AC 90 ms
80,468 KB
testcase_09 AC 105 ms
80,860 KB
testcase_10 AC 104 ms
81,012 KB
testcase_11 AC 111 ms
81,148 KB
testcase_12 AC 119 ms
80,876 KB
testcase_13 AC 121 ms
81,352 KB
testcase_14 AC 124 ms
80,872 KB
testcase_15 AC 133 ms
81,032 KB
testcase_16 AC 141 ms
80,972 KB
testcase_17 AC 74 ms
75,768 KB
testcase_18 AC 73 ms
75,840 KB
testcase_19 AC 74 ms
75,752 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