結果

問題 No.864 四方演算
ユーザー kumatan400
提出日時 2023-02-02 02:05:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 499 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,272 KB
実行使用メモリ 60,544 KB
最終ジャッジ日時 2024-07-01 18:58:26
合計ジャッジ時間 2,892 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    divisors = []
    i = 1
    while i * i <= n:
        if n % i == 0:
            divisors.append(i)
            j = n // i
            if i != j:
                divisors.append(j)
        i += 1
    return divisors


N = int(input())
K = int(input())

ans = 0
for s in make_divisors(K):
    a = min(s-1, N)
    b = max(1, s - N)
    n1 = max(0, a-b+1)
    
    t = K // s
    a = min(t-1, N)
    b = max(1, t - N)
    n2 = max(0, a-b+1)
    ans += n1 * n2
    

print(ans)
0