結果

問題 No.864 四方演算
ユーザー roarisroaris
提出日時 2019-08-17 14:30:39
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 564 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 60,052 KB
最終ジャッジ日時 2023-10-26 02:50:21
合計ジャッジ時間 2,374 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from math import ceil

N = int(input())
K = int(input())
ans = 0

for i in range(1, int(K**0.5)+1):
    if K % i == 0:
        P, Q = i, K // i
        
        if N >= P - 1 and N >= Q - 1:
            add = 2 * (P - 1) * (Q - 1)
        elif N >= P - 1 and Q - 2 >= N >= ceil(Q / 2):
            add = 2 * (P - 1) * (2 * N - Q + 1)
        elif P - 2 >= N >= ceil(P / 2) and N >= Q - 1:
            add = 2 * (2 * N - P + 1) * (Q - 1)
        else:
            add = 0
            
        if P == Q:
            add //= 2
        
        ans += add

print(ans)
0