結果

問題 No.2510 Six Cube Sum Counting
ユーザー kotatsugamekotatsugame
提出日時 2023-10-20 21:36:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 292 ms / 4,000 ms
コード長 542 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 64,228 KB
実行使用メモリ 291,448 KB
最終ジャッジ日時 2023-10-20 21:37:03
合計ジャッジ時間 9,107 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 225 ms
281,808 KB
testcase_01 AC 217 ms
291,404 KB
testcase_02 AC 282 ms
291,448 KB
testcase_03 AC 214 ms
291,404 KB
testcase_04 AC 245 ms
291,404 KB
testcase_05 AC 213 ms
291,404 KB
testcase_06 AC 250 ms
291,448 KB
testcase_07 AC 240 ms
291,404 KB
testcase_08 AC 237 ms
291,448 KB
testcase_09 AC 218 ms
291,404 KB
testcase_10 AC 225 ms
291,404 KB
testcase_11 AC 225 ms
291,404 KB
testcase_12 AC 257 ms
291,404 KB
testcase_13 AC 225 ms
291,404 KB
testcase_14 AC 224 ms
291,404 KB
testcase_15 AC 213 ms
291,404 KB
testcase_16 AC 216 ms
291,404 KB
testcase_17 AC 244 ms
291,404 KB
testcase_18 AC 220 ms
291,404 KB
testcase_19 AC 210 ms
291,404 KB
testcase_20 AC 251 ms
291,448 KB
testcase_21 AC 272 ms
291,448 KB
testcase_22 AC 292 ms
291,448 KB
testcase_23 AC 257 ms
291,448 KB
testcase_24 AC 273 ms
291,448 KB
testcase_25 AC 224 ms
291,448 KB
testcase_26 AC 277 ms
291,448 KB
testcase_27 AC 286 ms
291,448 KB
testcase_28 AC 221 ms
291,404 KB
testcase_29 AC 270 ms
291,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
using namespace std;
const int SZ=300*300*300*3;
int cnt[SZ+1];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	for(int a=0;a<=300;a++)for(int b=a;b<=300;b++)for(int c=b;c<=300;c++)cnt[a*a*a+b*b*b+c*c*c]++;
	long ans=0;
	int X;cin>>X;
	for(int c=0;c<=300;c++)
	{
		for(int a=0;a<=c;a++)for(int b=a;b<=c;b++)
		{
			int t=a*a*a+b*b*b+c*c*c;
			if(t<=X&&X-t<=SZ)ans+=cnt[X-t];
		}
		{//c<d
			for(int d=c;d<=300;d++)for(int e=d;e<=300;e++)cnt[c*c*c+d*d*d+e*e*e]--;
		}
	}
	cout<<ans<<endl;
}
0