結果

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

ソースコード

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 m[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;

	if(X>6*300*300*300){
		cout << 0 << endl;
		return 0;
	}

	int ans=0;
	for(int c=0;c<=300;c++){
		int C=c*c*c;
		for(int b=0;b<=c;b++){
			for(int a=0;a<=b;a++){
				int s=a*a*a+b*b*b+C;
				if(s>3*300*300*300) continue;
				m[s]++;
			}
		}


		for(int f=c;f<=300;f++){
			for(int e=c;e<=f;e++){
				int t=C+e*e*e+f*f*f;
				if(t>X) continue;
				ans+=m[X-t];
			}
		}

	}


	cout << ans << endl;


	return 0;
}
0