結果

問題 No.3331 Consecutive Cubic Sum
コンテスト
ユーザー himueu
提出日時 2025-11-02 21:37:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 330 bytes
コンパイル時間 3,373 ms
コンパイル使用メモリ 81,980 KB
実行使用メモリ 174,424 KB
最終ジャッジ日時 2025-11-02 21:38:02
合計ジャッジ時間 20,118 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [0]
m = 1
while m ** 3 <= 10 ** 18:
    a.append(a[-1] + m ** 3)
    m += 1
m -= 1
i = j = 0
ans = []
while i < m:
    while j < m and a[j] - a[i] < n:
        j += 1
    if j == m:
        break
    if a[j] - a[i] == n:
        ans.append((i + 1, j))
    i += 1

print(len(ans))
for ai in ans:
    print(*ai)
0