結果
問題 | No.2510 Six Cube Sum Counting |
ユーザー |
|
提出日時 | 2023-10-20 21:36:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 318 ms / 4,000 ms |
コード長 | 542 bytes |
コンパイル時間 | 526 ms |
コンパイル使用メモリ | 65,020 KB |
実行使用メモリ | 280,192 KB |
最終ジャッジ日時 | 2024-09-20 17:40:25 |
合計ジャッジ時間 | 9,399 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
#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<dfor(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;}