結果

問題 No.864 四方演算
ユーザー O2MTO2MT
提出日時 2021-02-16 01:49:00
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 100 ms / 1,000 ms
コード長 665 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 76,336 KB
最終ジャッジ日時 2023-09-30 23:39:43
合計ジャッジ時間 4,543 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,256 KB
testcase_01 AC 93 ms
75,992 KB
testcase_02 AC 86 ms
75,544 KB
testcase_03 AC 87 ms
75,312 KB
testcase_04 AC 94 ms
75,928 KB
testcase_05 AC 84 ms
75,456 KB
testcase_06 AC 89 ms
75,508 KB
testcase_07 AC 88 ms
75,456 KB
testcase_08 AC 86 ms
75,380 KB
testcase_09 AC 83 ms
75,532 KB
testcase_10 AC 85 ms
76,208 KB
testcase_11 AC 78 ms
75,768 KB
testcase_12 AC 86 ms
75,416 KB
testcase_13 AC 83 ms
75,544 KB
testcase_14 AC 77 ms
75,608 KB
testcase_15 AC 90 ms
75,540 KB
testcase_16 AC 88 ms
75,544 KB
testcase_17 AC 97 ms
75,932 KB
testcase_18 AC 100 ms
76,256 KB
testcase_19 AC 91 ms
76,336 KB
testcase_20 AC 98 ms
76,112 KB
testcase_21 AC 96 ms
76,304 KB
testcase_22 AC 94 ms
75,876 KB
testcase_23 AC 82 ms
76,068 KB
testcase_24 AC 88 ms
76,280 KB
testcase_25 AC 87 ms
75,932 KB
testcase_26 AC 93 ms
76,304 KB
testcase_27 AC 73 ms
71,484 KB
testcase_28 AC 73 ms
71,376 KB
testcase_29 AC 72 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)
print(count)
0