結果

問題 No.864 四方演算
ユーザー tcltktcltk
提出日時 2021-06-10 06:34:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 1,000 ms
コード長 887 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 83,668 KB
最終ジャッジ日時 2023-08-19 16:34:38
合計ジャッジ時間 8,998 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
80,876 KB
testcase_01 AC 214 ms
80,992 KB
testcase_02 AC 212 ms
81,264 KB
testcase_03 AC 211 ms
81,096 KB
testcase_04 AC 214 ms
81,164 KB
testcase_05 AC 207 ms
81,284 KB
testcase_06 AC 213 ms
81,292 KB
testcase_07 AC 210 ms
81,008 KB
testcase_08 AC 209 ms
81,012 KB
testcase_09 AC 203 ms
81,212 KB
testcase_10 AC 205 ms
81,176 KB
testcase_11 AC 202 ms
81,096 KB
testcase_12 AC 210 ms
81,264 KB
testcase_13 AC 207 ms
81,340 KB
testcase_14 AC 205 ms
81,360 KB
testcase_15 AC 216 ms
81,172 KB
testcase_16 AC 210 ms
81,092 KB
testcase_17 AC 212 ms
80,976 KB
testcase_18 AC 221 ms
83,668 KB
testcase_19 AC 209 ms
81,124 KB
testcase_20 AC 216 ms
80,976 KB
testcase_21 AC 216 ms
81,008 KB
testcase_22 AC 209 ms
81,212 KB
testcase_23 AC 202 ms
81,372 KB
testcase_24 AC 208 ms
80,988 KB
testcase_25 AC 204 ms
81,192 KB
testcase_26 AC 209 ms
81,192 KB
testcase_27 AC 197 ms
80,632 KB
testcase_28 AC 197 ms
80,628 KB
testcase_29 AC 193 ms
80,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """3
# 15
# """
# sys.stdin = io.StringIO(_INPUT)

def get_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]

def f(d):
    x = min(d, N)
    if max(1, d-x) <= min(x, d-1):
        return min(x, d-1) - max(1, d-x) + 1
    else:
        return 0

N = int(input())
K = int(input())
divs = get_divisors(K)
ans = 0
for d in divs:
    d1 = d
    d2 = K // d
    ans += f(d1) * f(d2)
print(ans)


0