結果

問題 No.2510 Six Cube Sum Counting
ユーザー 👑 chro_96chro_96
提出日時 2023-10-20 21:43:33
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 1,002 bytes
コンパイル時間 605 ms
コンパイル使用メモリ 30,260 KB
実行使用メモリ 111,652 KB
最終ジャッジ日時 2023-10-20 21:43:55
合計ジャッジ時間 6,205 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
107,440 KB
testcase_01 AC 30 ms
107,440 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int x = 0;
  
  int res = 0;
  
  int ans = 0;
  int flag[27000001] = {};
  int pow[301] = {};
  
  res = scanf("%d", &x);
  
  for (int i = 0; i <= 300; i++) {
    pow[i] = i*i*i;
    flag[pow[i]] = 1;
  }
  
  for (int f = 300; f >= 0; f--) {
    int tmp1 = pow[f];
    if (tmp1 <= x) {
      for (int e = f; e >= 0; e--) {
        int tmp2 = tmp1+pow[e];
        if (tmp2 <= x) {
          for (int d = e; d >= 0; d--) {
            int tmp3 = tmp2+pow[d];
            if (tmp3 <= x) {
              for (int c = d; c >= 0; c--) {
                int tmp4 = tmp3+pow[c];
                if (tmp4 <= x) {
                  for (int b = c; b >= 0; b--) {
                    int tmp = tmp4+pow[b];
                    if (tmp <= x && x-tmp <= pow[b]) {
                      ans += flag[x-tmp];
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  
  printf("%d\n", ans);
  return 0;
}
0