結果

問題 No.864 四方演算
ユーザー ryuhei1230ryuhei1230
提出日時 2019-08-16 22:22:18
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 51 ms / 1,000 ms
コード長 484 bytes
コンパイル時間 969 ms
コンパイル使用メモリ 81,800 KB
実行使用メモリ 60,244 KB
最終ジャッジ日時 2023-10-26 02:47:03
合計ジャッジ時間 2,324 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,720 KB
testcase_01 AC 50 ms
57,464 KB
testcase_02 AC 44 ms
57,464 KB
testcase_03 AC 46 ms
57,464 KB
testcase_04 AC 47 ms
57,464 KB
testcase_05 AC 44 ms
57,464 KB
testcase_06 AC 47 ms
57,464 KB
testcase_07 AC 46 ms
57,464 KB
testcase_08 AC 45 ms
57,464 KB
testcase_09 AC 40 ms
57,464 KB
testcase_10 AC 40 ms
57,464 KB
testcase_11 AC 38 ms
57,464 KB
testcase_12 AC 45 ms
57,464 KB
testcase_13 AC 43 ms
57,464 KB
testcase_14 AC 38 ms
57,464 KB
testcase_15 AC 48 ms
57,464 KB
testcase_16 AC 45 ms
57,464 KB
testcase_17 AC 47 ms
59,512 KB
testcase_18 AC 51 ms
60,244 KB
testcase_19 AC 46 ms
59,512 KB
testcase_20 AC 50 ms
59,512 KB
testcase_21 AC 48 ms
59,512 KB
testcase_22 AC 45 ms
59,512 KB
testcase_23 AC 38 ms
57,464 KB
testcase_24 AC 44 ms
57,464 KB
testcase_25 AC 41 ms
59,512 KB
testcase_26 AC 45 ms
59,512 KB
testcase_27 AC 33 ms
53,720 KB
testcase_28 AC 34 ms
53,720 KB
testcase_29 AC 33 ms
53,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
k = int(input())



def make_divisors(n):
    divisors = []
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            divisors.append((i, n//i))
            if i != n // i:
                divisors.append((n//i, i))

    return divisors


def dfs(x):
    if n >= x:
        return x - 1
    elif (x + 1) // 2 > n:
        return 0
    else:
        return n - (x - n) + 1



ret = 0
for a, b in make_divisors(k):
    ret += dfs(a) * dfs(b)


print(ret)
0