結果

問題 No.2510 Six Cube Sum Counting
ユーザー ojisan_ITojisan_IT
提出日時 2023-10-25 01:22:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3,933 ms / 4,000 ms
コード長 1,254 bytes
コンパイル時間 2,102 ms
コンパイル使用メモリ 176,076 KB
実行使用メモリ 253,468 KB
最終ジャッジ日時 2023-10-25 01:24:44
合計ジャッジ時間 116,103 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,502 ms
253,400 KB
testcase_01 AC 3,467 ms
253,400 KB
testcase_02 AC 3,779 ms
253,400 KB
testcase_03 AC 3,508 ms
253,400 KB
testcase_04 AC 3,476 ms
253,400 KB
testcase_05 AC 3,557 ms
253,400 KB
testcase_06 AC 3,593 ms
253,400 KB
testcase_07 AC 3,742 ms
253,400 KB
testcase_08 AC 3,488 ms
253,400 KB
testcase_09 AC 3,531 ms
253,400 KB
testcase_10 AC 3,619 ms
253,400 KB
testcase_11 AC 3,698 ms
253,400 KB
testcase_12 AC 3,636 ms
253,400 KB
testcase_13 AC 3,598 ms
253,400 KB
testcase_14 AC 3,421 ms
253,400 KB
testcase_15 AC 3,455 ms
253,400 KB
testcase_16 AC 3,456 ms
253,400 KB
testcase_17 AC 3,460 ms
253,400 KB
testcase_18 AC 3,442 ms
253,400 KB
testcase_19 AC 3,522 ms
253,400 KB
testcase_20 AC 3,754 ms
253,400 KB
testcase_21 AC 3,762 ms
253,400 KB
testcase_22 AC 3,777 ms
253,468 KB
testcase_23 AC 3,933 ms
253,400 KB
testcase_24 AC 3,841 ms
253,468 KB
testcase_25 AC 3,591 ms
253,400 KB
testcase_26 AC 3,701 ms
253,400 KB
testcase_27 AC 3,808 ms
253,468 KB
testcase_28 AC 3,624 ms
253,400 KB
testcase_29 AC 3,825 ms
253,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)

//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
const int IINF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;

/*Coding Space*/
int main(){
  ll a,b,c,d,e,f,x; cin >> x;
  map<ll,int> m;
  ll ans = 0;
  // Dを決め打ちすると、cのfor更新がさぼれる
  for(d = 0; d < 301; ++d){
    c = d;
    for(b = 0; b <= c; ++b)for(a = 0; a <= b; ++a) m[c*c*c + b*b*b + a*a*a]++;
    for(e = d; e < 301; ++e)
      for(f = e; f < 301; ++f){
        ll tar = x - d*d*d - e*e*e - f*f*f;
        if(tar < 0) break;
        if(m.count(tar)) ans += m[tar];
      }
  }
  cout << ans << endl;
}
0