結果

問題 No.2510 Six Cube Sum Counting
ユーザー chro_96
提出日時 2023-10-20 21:53:03
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 157 ms / 4,000 ms
コード長 660 bytes
コンパイル時間 1,206 ms
コンパイル使用メモリ 29,568 KB
実行使用メモリ 318,260 KB
最終ジャッジ日時 2024-09-20 18:31:18
合計ジャッジ時間 5,994 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int x = 0;
  
  int res = 0;
  
  long long ans = 0LL;
  int cnt[81000001] = {};
  int pow[301] = {};
  
  res = scanf("%d", &x);
  
  for (int i = 0; i <= 300; i++) {
    pow[i] = i*i*i;
  }
  
  for (int d = 0; d <= 300; d++) {
    for (int a = 0; a <= d; a++) {
      for (int b = a; b <= d; b++) {
        cnt[pow[a]+pow[b]+pow[d]]++;
      }
    }
    for (int e = d; e <= 300; e++) {
      for (int f = e; f <= 300; f++) {
        int tmp = pow[d]+pow[e]+pow[f];
        if (tmp <= x && x-tmp <= pow[d]*3) {
          ans += (long long)cnt[x-tmp];
        }
      }
    }
  }
  
  printf("%lld\n", ans);
  return 0;
}
0