結果

問題 No.2510 Six Cube Sum Counting
ユーザー 👑 seekworser
提出日時 2023-09-20 14:46:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,575 ms / 4,000 ms
コード長 720 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 82,140 KB
実行使用メモリ 304,968 KB
最終ジャッジ日時 2024-09-19 12:37:44
合計ジャッジ時間 30,393 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

x = int(input())
ans = 0
atoc = dict()
for d in range(301):
    cd = d*d*d
    xi = x - cd
    if xi < 0:
        break
    for a in range(d+1):
        ca = a*a*a
        if ca + cd > xi:
            break
        for b in range(a, d+1):
            total = ca + b*b*b + cd
            if total > xi:
                break
            if total in atoc:
                atoc[total] += 1
            else:
                atoc[total] = 1
    for e in range(d, 301):
        ce = e*e*e
        if ce > xi:
            break
        for f in range(e, 301):
            total = ce + f*f*f
            if total > xi:
                break
            if xi - total in atoc:
                ans += atoc[xi - total]
print(ans)
0