結果

問題 No.2510 Six Cube Sum Counting
ユーザー daiota
提出日時 2023-10-21 08:02:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 604 bytes
コンパイル時間 1,402 ms
コンパイル使用メモリ 166,088 KB
実行使用メモリ 113,920 KB
最終ジャッジ日時 2024-09-21 09:05:11
合計ジャッジ時間 5,695 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12 RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)

int x[3*300*300*300+10];

int main(void){
	cin.tie(nullptr);  ios_base::sync_with_stdio(false);
	int i,j,k;

	int X;
	cin >> X;

	int ans=0;
	for(int c=0;c<=300;c++){

		for(int b=0;b<=c;b++){
			for(int a=0;a<=b;a++){
				int s=a*a*a+b*b*b+c*c*c;
				if(2*s>X) continue;
				x[s]++;
			}
		}


		for(int f=c;f<=300;f++){
			for(int e=c;e<=f;e++){
				int s=c*c*c+e*e*e+f*f*f;
				if(s>X) break;
				ans+=x[X-s];
			}
		}

	}


	cout << ans << endl;


	return 0;
}
0