結果

問題 No.1318 ABCD quadruplets
ユーザー H3PO4
提出日時 2022-10-09 09:10:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,322 ms / 2,000 ms
コード長 742 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 84,736 KB
最終ジャッジ日時 2024-06-23 08:38:58
合計ジャッジ時間 11,886 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())

res = [0] * (N + 1)
for a in range(M + 1):
    a_ = a ** 2
    for b in range(a, M + 1):
        b_ = b * (a + b)
        for c in range(b, M + 1):
            c_ = c * (a + b + c)
            for d in range(c, M + 1):
                x = a_ + b_ + c_ + d * (a + b + c + d)
                if x > N:
                    break
                if a == b == c == d:
                    res[x] += 1
                elif a == b == c or b == c == d:
                    res[x] += 4
                elif a == b and c == d:
                    res[x] += 6
                elif a == b or b == c or c == d:
                    res[x] += 12
                else:
                    res[x] += 24

print(*res, sep="\n")
0