結果

問題 No.781 円周上の格子点の数え上げ
ユーザー hedwig100hedwig100
提出日時 2020-04-13 14:30:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 780 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 153,340 KB
最終ジャッジ日時 2023-10-25 03:25:10
合計ジャッジ時間 4,106 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,128 KB
testcase_01 AC 39 ms
57,128 KB
testcase_02 AC 38 ms
57,128 KB
testcase_03 AC 38 ms
57,128 KB
testcase_04 AC 38 ms
57,128 KB
testcase_05 AC 39 ms
57,128 KB
testcase_06 AC 41 ms
59,720 KB
testcase_07 AC 42 ms
60,236 KB
testcase_08 AC 105 ms
139,772 KB
testcase_09 AC 107 ms
139,772 KB
testcase_10 AC 43 ms
59,860 KB
testcase_11 AC 44 ms
60,092 KB
testcase_12 AC 349 ms
142,108 KB
testcase_13 AC 780 ms
153,340 KB
testcase_14 AC 54 ms
66,204 KB
testcase_15 AC 45 ms
61,788 KB
testcase_16 AC 43 ms
59,544 KB
testcase_17 AC 489 ms
121,516 KB
testcase_18 AC 80 ms
107,960 KB
testcase_19 AC 82 ms
109,344 KB
testcase_20 AC 82 ms
109,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    x,y = map(int,input().split())
    square = []
    for i in range(10000):
        if i * i <= y:
            square.append(i * i)
    
    cnt = [0] * (y + 1)
    for q1 in square:
        for q2 in square:
            if x <= q1 + q2 <= y:
                if q1 == 0 or q2 == 0:
                    cnt[q1 + q2] += 2
                else:
                    cnt[q1 + q2] += 4
    
    ans = 0
    for i in range(x,y + 1):
        ans = max(ans,cnt[i])
    
    #print(cnt,square)
    print(ans)

if __name__ =='__main__':
    main()   
0