結果

問題 No.732 3PrimeCounting
ユーザー annin256annin256
提出日時 2018-09-07 22:37:44
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 697 bytes
コンパイル時間 1,135 ms
コンパイル使用メモリ 29,044 KB
実行使用メモリ 7,892 KB
最終ジャッジ日時 2023-08-19 20:42:01
合計ジャッジ時間 57,943 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,384 KB
testcase_01 AC 5 ms
4,380 KB
testcase_02 AC 6 ms
4,380 KB
testcase_03 AC 6 ms
4,384 KB
testcase_04 AC 7 ms
4,380 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 6 ms
4,380 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 AC 6 ms
4,384 KB
testcase_09 AC 6 ms
4,380 KB
testcase_10 AC 6 ms
4,384 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 6 ms
4,380 KB
testcase_13 AC 6 ms
4,384 KB
testcase_14 AC 7 ms
4,384 KB
testcase_15 AC 6 ms
4,384 KB
testcase_16 AC 7 ms
4,384 KB
testcase_17 AC 6 ms
4,380 KB
testcase_18 AC 7 ms
4,380 KB
testcase_19 AC 7 ms
4,384 KB
testcase_20 AC 29 ms
4,380 KB
testcase_21 AC 85 ms
4,380 KB
testcase_22 AC 85 ms
4,380 KB
testcase_23 AC 14 ms
4,380 KB
testcase_24 AC 13 ms
4,384 KB
testcase_25 AC 148 ms
4,380 KB
testcase_26 AC 111 ms
4,384 KB
testcase_27 AC 39 ms
4,384 KB
testcase_28 AC 39 ms
4,384 KB
testcase_29 AC 70 ms
4,380 KB
testcase_30 AC 70 ms
4,384 KB
testcase_31 AC 91 ms
4,380 KB
testcase_32 AC 124 ms
4,380 KB
testcase_33 AC 125 ms
4,380 KB
testcase_34 AC 124 ms
4,380 KB
testcase_35 AC 100 ms
4,384 KB
testcase_36 AC 100 ms
4,384 KB
testcase_37 AC 22 ms
4,380 KB
testcase_38 AC 22 ms
4,380 KB
testcase_39 AC 104 ms
4,384 KB
testcase_40 AC 94 ms
4,380 KB
testcase_41 AC 95 ms
4,384 KB
testcase_42 AC 94 ms
4,384 KB
testcase_43 AC 77 ms
4,380 KB
testcase_44 AC 77 ms
4,380 KB
testcase_45 AC 46 ms
4,380 KB
testcase_46 AC 46 ms
4,380 KB
testcase_47 AC 57 ms
4,380 KB
testcase_48 AC 160 ms
4,380 KB
testcase_49 AC 159 ms
4,384 KB
testcase_50 AC 86 ms
4,380 KB
testcase_51 AC 88 ms
4,384 KB
testcase_52 AC 43 ms
4,380 KB
testcase_53 AC 301 ms
4,384 KB
testcase_54 AC 1,687 ms
5,556 KB
testcase_55 AC 1,681 ms
5,752 KB
testcase_56 AC 1,683 ms
5,636 KB
testcase_57 AC 593 ms
4,380 KB
testcase_58 AC 593 ms
4,380 KB
testcase_59 AC 319 ms
4,384 KB
testcase_60 AC 763 ms
4,380 KB
testcase_61 AC 762 ms
4,416 KB
testcase_62 AC 2,020 ms
6,068 KB
testcase_63 AC 1,152 ms
4,916 KB
testcase_64 AC 904 ms
4,528 KB
testcase_65 AC 903 ms
4,532 KB
testcase_66 AC 12 ms
4,380 KB
testcase_67 AC 13 ms
4,384 KB
testcase_68 AC 1,835 ms
5,868 KB
testcase_69 AC 1,839 ms
5,832 KB
testcase_70 AC 1,701 ms
5,732 KB
testcase_71 AC 1,701 ms
5,768 KB
testcase_72 AC 1,102 ms
4,800 KB
testcase_73 AC 2,805 ms
6,940 KB
testcase_74 AC 2,794 ms
7,000 KB
testcase_75 AC 143 ms
4,380 KB
testcase_76 AC 1,806 ms
5,840 KB
testcase_77 AC 624 ms
4,384 KB
testcase_78 AC 2,352 ms
6,504 KB
testcase_79 AC 1,858 ms
5,864 KB
testcase_80 AC 2,177 ms
6,344 KB
testcase_81 AC 1,719 ms
5,704 KB
testcase_82 AC 35 ms
4,380 KB
testcase_83 AC 606 ms
4,380 KB
testcase_84 AC 656 ms
4,388 KB
testcase_85 AC 1,525 ms
5,372 KB
testcase_86 AC 2,211 ms
6,388 KB
testcase_87 TLE -
testcase_88 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int pr[300001];
int prs[26000];
int ptr;
long long dp[4][300000];

int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= 300000; i++) {
    if (!pr[i]) {
      prs[ptr++] = i;
      for (int j = i * 2; j <= 300000; j += i) {
        pr[j] = 1;
      }
    }
    pr[i] = !pr[i];
  }
  dp[0][0] = 1;
  for (int k = 0; prs[k] <= n; k++) {
    for (int i = 2; i >= 0; i--) {
      for (int j = 0; j <= 100000 * i; j++) {
        if (dp[i][j] == 0) continue;
        dp[i + 1][prs[k] + j] += dp[i][j];
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < 300000; i++) {
    if (pr[i]) {
      ans += dp[3][i];
    }
  }
  printf("%lld\n", ans);
  return 0;
}

0