結果
| 問題 | No.3331 Consecutive Cubic Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-01 03:00:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 575 bytes |
| コンパイル時間 | 1,846 ms |
| コンパイル使用メモリ | 198,596 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-02 21:10:55 |
| 合計ジャッジ時間 | 3,494 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 WA * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
__int128_t 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){
__int128_t 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;
}