結果

問題 No.864 四方演算
ユーザー jensenjensen
提出日時 2021-01-15 17:53:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 166 ms / 1,000 ms
コード長 555 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 8,296 KB
最終ジャッジ日時 2023-08-17 12:32:23
合計ジャッジ時間 4,783 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,872 KB
testcase_01 AC 166 ms
7,824 KB
testcase_02 AC 116 ms
7,828 KB
testcase_03 AC 128 ms
7,828 KB
testcase_04 AC 144 ms
7,776 KB
testcase_05 AC 106 ms
7,828 KB
testcase_06 AC 145 ms
7,852 KB
testcase_07 AC 132 ms
7,852 KB
testcase_08 AC 117 ms
7,808 KB
testcase_09 AC 75 ms
7,824 KB
testcase_10 AC 68 ms
7,816 KB
testcase_11 AC 41 ms
7,804 KB
testcase_12 AC 120 ms
7,844 KB
testcase_13 AC 88 ms
7,796 KB
testcase_14 AC 45 ms
7,828 KB
testcase_15 AC 166 ms
7,840 KB
testcase_16 AC 125 ms
7,936 KB
testcase_17 AC 141 ms
7,884 KB
testcase_18 AC 127 ms
8,296 KB
testcase_19 AC 102 ms
7,776 KB
testcase_20 AC 149 ms
7,956 KB
testcase_21 AC 126 ms
7,940 KB
testcase_22 AC 113 ms
7,840 KB
testcase_23 AC 28 ms
7,772 KB
testcase_24 AC 103 ms
7,812 KB
testcase_25 AC 60 ms
7,824 KB
testcase_26 AC 113 ms
7,800 KB
testcase_27 AC 15 ms
7,812 KB
testcase_28 AC 16 ms
7,828 KB
testcase_29 AC 15 ms
7,836 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]

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

yakusu=make_divisors(k)
comb=[0]*len(yakusu)
s=0
for k in range(1,len(yakusu)):
    if(yakusu[k]<=2*n):
        comb[k]=yakusu[k]-1-2*max(0,yakusu[k]-n-1)
for i in range(len(yakusu)):
    s+=comb[i]*comb[len(yakusu)-1-i]

print(s)
0