結果

問題 No.781 円周上の格子点の数え上げ
ユーザー prd_xxx
提出日時 2019-01-11 22:25:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 71,936 KB
最終ジャッジ日時 2024-11-30 08:48:21
合計ジャッジ時間 6,203 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

X,Y = map(int,input().split())
arr = []
a = 1
while a*a <= Y:
    arr.append(a*a)
    a += 1

def is_square(n):
    return n**0.5 == int(n**0.5)

def calc(n):
    ret = 0
    for a in arr:
        if n-a <= 0: break
        if is_square(n-a):
            ret += 1
    if is_square(n):
        ret += 1
    return ret * 4

ans = 0
for n in range(max(X,Y-5000),Y+1):
    ans = max(ans, calc(n))
print(ans)
0