結果

問題 No.864 四方演算
ユーザー tcltktcltk
提出日時 2021-06-10 06:36:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 224 ms / 1,000 ms
コード長 852 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 83,604 KB
最終ジャッジ日時 2023-08-19 16:37:08
合計ジャッジ時間 8,490 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 197 ms
80,664 KB
testcase_01 AC 215 ms
81,268 KB
testcase_02 AC 212 ms
80,944 KB
testcase_03 AC 214 ms
80,956 KB
testcase_04 AC 214 ms
81,136 KB
testcase_05 AC 208 ms
81,268 KB
testcase_06 AC 212 ms
80,808 KB
testcase_07 AC 210 ms
80,904 KB
testcase_08 AC 212 ms
80,900 KB
testcase_09 AC 205 ms
80,948 KB
testcase_10 AC 204 ms
80,804 KB
testcase_11 AC 202 ms
81,036 KB
testcase_12 AC 208 ms
80,812 KB
testcase_13 AC 206 ms
80,784 KB
testcase_14 AC 201 ms
80,780 KB
testcase_15 AC 215 ms
81,056 KB
testcase_16 AC 210 ms
81,056 KB
testcase_17 AC 212 ms
81,084 KB
testcase_18 AC 224 ms
83,604 KB
testcase_19 AC 210 ms
80,996 KB
testcase_20 AC 215 ms
80,824 KB
testcase_21 AC 217 ms
80,956 KB
testcase_22 AC 211 ms
80,992 KB
testcase_23 AC 199 ms
81,204 KB
testcase_24 AC 210 ms
80,856 KB
testcase_25 AC 203 ms
81,244 KB
testcase_26 AC 213 ms
81,056 KB
testcase_27 AC 198 ms
80,720 KB
testcase_28 AC 198 ms
80,740 KB
testcase_29 AC 195 ms
80,796 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 = sum(f(d) * f(K//d) for d in divs)
print(ans)


0