結果

問題 No.864 四方演算
ユーザー ronpooronpoo
提出日時 2023-09-07 17:00:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 1,000 ms
コード長 562 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 87,316 KB
実行使用メモリ 76,152 KB
最終ジャッジ日時 2023-09-07 17:00:07
合計ジャッジ時間 4,694 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,392 KB
testcase_01 AC 94 ms
75,608 KB
testcase_02 AC 88 ms
75,544 KB
testcase_03 AC 87 ms
75,612 KB
testcase_04 AC 90 ms
75,684 KB
testcase_05 AC 85 ms
75,664 KB
testcase_06 AC 87 ms
75,556 KB
testcase_07 AC 88 ms
75,624 KB
testcase_08 AC 86 ms
75,296 KB
testcase_09 AC 82 ms
75,576 KB
testcase_10 AC 81 ms
75,468 KB
testcase_11 AC 78 ms
75,628 KB
testcase_12 AC 85 ms
75,620 KB
testcase_13 AC 84 ms
75,468 KB
testcase_14 AC 83 ms
75,864 KB
testcase_15 AC 93 ms
75,648 KB
testcase_16 AC 88 ms
75,544 KB
testcase_17 AC 88 ms
75,848 KB
testcase_18 AC 93 ms
76,152 KB
testcase_19 AC 86 ms
75,460 KB
testcase_20 AC 89 ms
75,480 KB
testcase_21 AC 87 ms
75,292 KB
testcase_22 AC 85 ms
75,544 KB
testcase_23 AC 76 ms
75,464 KB
testcase_24 AC 86 ms
75,304 KB
testcase_25 AC 82 ms
75,516 KB
testcase_26 AC 86 ms
75,540 KB
testcase_27 AC 72 ms
71,344 KB
testcase_28 AC 71 ms
71,340 KB
testcase_29 AC 72 ms
71,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

# 約数列挙
def make_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]

div = make_divisors(K)

ans = 0
for v in div:
    v -= 1
    x = 0
    if v <= 2*N:
        x = min(v, v-(v-N)*2)
    v = K//(v+1)-1
    y = 0
    if v <= 2*N:
        y = min(v, v-(v-N)*2)
    ans += x * y
print(ans)
0