結果

問題 No.3331 Consecutive Cubic Sum
コンテスト
ユーザー himueu
提出日時 2025-11-02 21:43:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 379 ms / 5,000 ms
コード長 320 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 174,476 KB
最終ジャッジ日時 2025-11-02 21:43:44
合計ジャッジ時間 20,523 ms
ジャッジサーバーID
(参考情報)
judge4 / judge8
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

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

while i < m:
    while j < m and a[j] - a[i] < n:
        j += 1
    if a[j] - a[i] == n:
        ans.append((i + 1, j))
    i += 1

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