結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 tatyam
提出日時 2020-07-25 00:07:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,385 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 78,440 KB
最終ジャッジ日時 2024-06-25 23:35:48
合計ジャッジ時間 13,065 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())

ans = [0]*(n+1)
for a in range(m + 1):
    for b in range(a,m + 1):
        for c in range(b,m + 1):
            for d in range(c,m + 1):
                s = a * a + (a + b) * b + (a + b + c) * c + (a + b + c + d) * d
                if s > n:
                    break
                if a == b == c == d:
                    ans[s] += 1
                elif a == b == c or b == c == d:
                    ans[s] += 4
                elif a == b and c == d:
                    ans[s] += 6
                elif a == b or b == c or c == d:
                    ans[s] += 12
                else:
                    ans[s] += 24

for i in ans:
    print(i)
0