結果
| 問題 | 
                            No.3331 Consecutive Cubic Sum
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-11-02 21:29:13 | 
| 言語 | C#  (.NET 8.0.404)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 92 ms / 5,000 ms | 
| コード長 | 824 bytes | 
| コンパイル時間 | 19,086 ms | 
| コンパイル使用メモリ | 170,860 KB | 
| 実行使用メモリ | 197,152 KB | 
| 最終ジャッジ日時 | 2025-11-02 21:31:59 | 
| 合計ジャッジ時間 | 16,306 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge6 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 47 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (128 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
class Program
{
    static long NN => long.Parse(ReadLine());
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var cum = new long[1_000_002];
        for (var i = 1L; i < cum.Length; ++i) cum[i] = cum[i - 1] + i * i * i;
        var ans = new List<int[]>();
        var j = 0;
        for (var i = 0; i < cum.Length; ++i)
        {
            while (j < i && cum[i] - cum[j] > n) ++j;
            if (cum[i] - cum[j] == n) ans.Add(new int[] { j + 1, i });
        }
        WriteLine(ans.Count);
        if (ans.Count > 0) WriteLine(string.Join("\n", ans.Select(ai => string.Join(" ", ai))));
    }
}