結果

問題 No.864 四方演算
ユーザー tcltktcltk
提出日時 2021-06-10 06:35:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 864 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 83,276 KB
最終ジャッジ日時 2023-08-19 16:35:05
合計ジャッジ時間 7,946 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 201 ms
80,724 KB
testcase_01 AC 215 ms
81,016 KB
testcase_02 AC 209 ms
81,284 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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

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