結果

問題 No.864 四方演算
ユーザー O2MTO2MT
提出日時 2021-02-16 01:50:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 1,000 ms
コード長 683 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 86,608 KB
実行使用メモリ 76,096 KB
最終ジャッジ日時 2023-09-30 23:40:30
合計ジャッジ時間 4,573 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,064 KB
testcase_01 AC 94 ms
75,576 KB
testcase_02 AC 87 ms
75,112 KB
testcase_03 AC 87 ms
75,268 KB
testcase_04 AC 90 ms
75,524 KB
testcase_05 AC 84 ms
75,080 KB
testcase_06 AC 87 ms
75,312 KB
testcase_07 AC 85 ms
74,996 KB
testcase_08 AC 84 ms
75,076 KB
testcase_09 AC 79 ms
75,436 KB
testcase_10 AC 80 ms
75,876 KB
testcase_11 AC 78 ms
75,076 KB
testcase_12 AC 82 ms
75,072 KB
testcase_13 AC 79 ms
75,008 KB
testcase_14 AC 74 ms
75,164 KB
testcase_15 AC 90 ms
75,420 KB
testcase_16 AC 84 ms
75,080 KB
testcase_17 AC 90 ms
75,712 KB
testcase_18 AC 96 ms
75,944 KB
testcase_19 AC 87 ms
75,768 KB
testcase_20 AC 96 ms
76,096 KB
testcase_21 AC 91 ms
75,716 KB
testcase_22 AC 88 ms
75,652 KB
testcase_23 AC 75 ms
75,644 KB
testcase_24 AC 86 ms
75,804 KB
testcase_25 AC 79 ms
75,776 KB
testcase_26 AC 87 ms
75,796 KB
testcase_27 AC 67 ms
71,140 KB
testcase_28 AC 71 ms
71,112 KB
testcase_29 AC 70 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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]

def check_pattern(n,p):
    if 2 <= p <= n+1:
        num = p-1
    elif n+2 <= p <= 2*n:
        num = 2*n+1-p
    else:
        num = 0
    return num

N,K = int(input()),int(input())
l = list(filter(lambda x: x <= 2*N, make_divisors(K)))
count = 0
for i in l:
    for j in l:
        if i*j == K:
            count += check_pattern(N,i)*check_pattern(N,j)
            break
print(count)
0