結果

問題 No.864 四方演算
ユーザー moharan627moharan627
提出日時 2021-06-01 13:28:34
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 166 ms / 1,000 ms
コード長 1,098 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 8,504 KB
最終ジャッジ日時 2023-08-08 17:12:29
合計ジャッジ時間 4,684 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,296 KB
testcase_01 AC 166 ms
8,388 KB
testcase_02 AC 116 ms
8,288 KB
testcase_03 AC 129 ms
8,424 KB
testcase_04 AC 145 ms
8,400 KB
testcase_05 AC 107 ms
8,416 KB
testcase_06 AC 146 ms
8,288 KB
testcase_07 AC 132 ms
8,440 KB
testcase_08 AC 117 ms
8,264 KB
testcase_09 AC 74 ms
8,388 KB
testcase_10 AC 67 ms
8,264 KB
testcase_11 AC 41 ms
8,348 KB
testcase_12 AC 118 ms
8,412 KB
testcase_13 AC 88 ms
8,440 KB
testcase_14 AC 45 ms
8,292 KB
testcase_15 AC 165 ms
8,260 KB
testcase_16 AC 125 ms
8,404 KB
testcase_17 AC 142 ms
8,156 KB
testcase_18 AC 127 ms
8,352 KB
testcase_19 AC 101 ms
8,344 KB
testcase_20 AC 149 ms
8,308 KB
testcase_21 AC 126 ms
8,400 KB
testcase_22 AC 113 ms
8,400 KB
testcase_23 AC 27 ms
8,344 KB
testcase_24 AC 104 ms
8,316 KB
testcase_25 AC 62 ms
8,504 KB
testcase_26 AC 114 ms
8,276 KB
testcase_27 AC 16 ms
8,312 KB
testcase_28 AC 16 ms
8,316 KB
testcase_29 AC 15 ms
8,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10**9 + 7
def solve():
    def II(): return int(sys.stdin.readline())
    def LI(): return list(map(int, sys.stdin.readline().split()))
    def LC(): return list(input())
    def IC(): return [int(c) for c in input()]
    def MI(): return map(int, sys.stdin.readline().split())
    N= II()
    K = II()
    def make_divisors(n):
        lower_divisors, upper_divisors = [], []
        i = 1
        while i * i <= n:
            if n % i == 0:
                lower_divisors.append(i)
                if i != n // i:
                    upper_divisors.append(n // i)
            i += 1
        return lower_divisors + upper_divisors[::-1]
    Div = make_divisors(K)
    Dl = len(Div)
    from math import ceil
    Ans = 0
    for n in range(Dl):
        Divmin = Div[n]
        Divmax = Div[Dl-n-1]
        #print(Divmin,Divmax)
        #print(min(Divmin-1,2*N-Divmin+1),min(Divmax-1,2*N-Divmax+1))
        Ans += max(min(Divmin-1,2*N-Divmin+1) * min(Divmax-1,2*N-Divmax+1),0)
        #print(Ans)
    print(Ans)
    return
solve()
0