結果

問題 No.2510 Six Cube Sum Counting
ユーザー maksim
提出日時 2023-10-20 22:58:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 406 ms / 4,000 ms
コード長 703 bytes
コンパイル時間 1,694 ms
コンパイル使用メモリ 166,144 KB
実行使用メモリ 280,192 KB
最終ジャッジ日時 2024-09-20 21:19:36
合計ジャッジ時間 12,048 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
int32_t cnt[81000001];
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int res=0;
    int x;cin>>x;
    for(int c=300;c>=0;--c)
    {
        for(int e=300;e>=c;--e)
        {
            for(int f=300;f>=e;--f)
            {
                cnt[c*c*c+e*e*e+f*f*f]++;
            }
        }
        for(int b=c;b>=0;--b)
        {
            for(int a=b;a>=0;--a)
            {
                int rem=x-a*a*a-b*b*b-c*c*c;
                if(rem>=0 && rem<81000001)
                {
                    res+=cnt[rem];
                }
            }
        }
    }
    cout<<res;
    return 0;
}
0