結果
| 問題 | 
                            No.3331 Consecutive Cubic Sum
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-10-01 02:30:42 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 555 bytes | 
| コンパイル時間 | 1,872 ms | 
| コンパイル使用メモリ | 198,348 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-11-02 21:10:32 | 
| 合計ジャッジ時間 | 3,424 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 42 WA * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll cube_sum(ll x){
    return x * (x + 1) / 2 * x * (x + 1) / 2;
}
int main() {
    ll n;
    cin >> n;
    assert(1 <= n && n <= 1000000000000000000);
    ll l = 1, r = 1;
    vector<pair<ll, ll>> ans;
    while (r * r * r <= n){
        ll t = cube_sum(r) - cube_sum(l - 1);
        if (t == n){
            ans.push_back({l, r});
        }
        if (t <= n) r++;
        else l++;
    }
    cout << ans.size() << endl;
    for (auto [x, y] : ans) cout << x << " " << y << endl;
}