結果

問題 No.2510 Six Cube Sum Counting
ユーザー i_am_noob
提出日時 2023-11-14 23:01:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 380 ms / 4,000 ms
コード長 620 bytes
コンパイル時間 1,960 ms
コンパイル使用メモリ 192,696 KB
最終ジャッジ日時 2025-02-17 22:02:08
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;

#define all(a) a.begin(),a.end()
#define pb push_back
#define sz(a) ((int)a.size())

const int N=81000005;
int cnt[N];

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    int x; cin >> x;
    ll res=0;
    for(int d=0; d<=300; ++d){
        // add c=d
        for(int a=0; a<=d; ++a) for(int b=a; b<=d; ++b) cnt[a*a*a+b*b*b+d*d*d]++;
        for(int e=d; e<=300; ++e) for(int f=e; f<=300; ++f){
            int y=x-d*d*d-e*e*e-f*f*f;
            if(y>=0&&y<N) res+=cnt[y];
        }
    }
    cout << res << "\n";
}
0