結果

問題 No.732 3PrimeCounting
ユーザー annin256annin256
提出日時 2018-09-07 22:37:55
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2,076 ms / 3,000 ms
コード長 660 bytes
コンパイル時間 1,038 ms
コンパイル使用メモリ 28,316 KB
実行使用メモリ 8,600 KB
最終ジャッジ日時 2023-08-19 20:39:02
合計ジャッジ時間 41,290 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
6,308 KB
testcase_01 AC 7 ms
6,376 KB
testcase_02 AC 7 ms
6,348 KB
testcase_03 AC 7 ms
6,392 KB
testcase_04 AC 7 ms
6,344 KB
testcase_05 AC 8 ms
6,344 KB
testcase_06 AC 8 ms
6,372 KB
testcase_07 AC 7 ms
6,380 KB
testcase_08 AC 8 ms
6,400 KB
testcase_09 AC 8 ms
6,232 KB
testcase_10 AC 7 ms
6,288 KB
testcase_11 AC 8 ms
6,328 KB
testcase_12 AC 8 ms
6,252 KB
testcase_13 AC 8 ms
6,280 KB
testcase_14 AC 8 ms
6,352 KB
testcase_15 AC 8 ms
6,296 KB
testcase_16 AC 8 ms
6,400 KB
testcase_17 AC 8 ms
6,232 KB
testcase_18 AC 10 ms
6,292 KB
testcase_19 AC 8 ms
6,332 KB
testcase_20 AC 29 ms
6,364 KB
testcase_21 AC 80 ms
6,340 KB
testcase_22 AC 79 ms
6,360 KB
testcase_23 AC 15 ms
6,400 KB
testcase_24 AC 15 ms
6,388 KB
testcase_25 AC 132 ms
6,392 KB
testcase_26 AC 101 ms
6,388 KB
testcase_27 AC 37 ms
6,348 KB
testcase_28 AC 37 ms
6,372 KB
testcase_29 AC 66 ms
6,352 KB
testcase_30 AC 65 ms
6,416 KB
testcase_31 AC 84 ms
6,292 KB
testcase_32 AC 112 ms
6,436 KB
testcase_33 AC 112 ms
6,416 KB
testcase_34 AC 113 ms
6,336 KB
testcase_35 AC 91 ms
6,320 KB
testcase_36 AC 90 ms
6,444 KB
testcase_37 AC 22 ms
6,356 KB
testcase_38 AC 22 ms
6,352 KB
testcase_39 AC 94 ms
6,376 KB
testcase_40 AC 87 ms
6,352 KB
testcase_41 AC 86 ms
6,368 KB
testcase_42 AC 87 ms
6,384 KB
testcase_43 AC 71 ms
6,428 KB
testcase_44 AC 72 ms
6,404 KB
testcase_45 AC 44 ms
6,256 KB
testcase_46 AC 44 ms
6,352 KB
testcase_47 AC 53 ms
6,328 KB
testcase_48 AC 142 ms
6,516 KB
testcase_49 AC 143 ms
6,492 KB
testcase_50 AC 81 ms
6,428 KB
testcase_51 AC 81 ms
6,356 KB
testcase_52 AC 40 ms
6,412 KB
testcase_53 AC 258 ms
6,524 KB
testcase_54 AC 1,192 ms
7,572 KB
testcase_55 AC 1,184 ms
7,628 KB
testcase_56 AC 1,192 ms
7,584 KB
testcase_57 AC 483 ms
6,860 KB
testcase_58 AC 483 ms
6,796 KB
testcase_59 AC 272 ms
6,600 KB
testcase_60 AC 603 ms
6,872 KB
testcase_61 AC 601 ms
6,984 KB
testcase_62 AC 1,381 ms
7,856 KB
testcase_63 AC 873 ms
7,288 KB
testcase_64 AC 702 ms
7,012 KB
testcase_65 AC 704 ms
7,100 KB
testcase_66 AC 14 ms
6,408 KB
testcase_67 AC 14 ms
6,400 KB
testcase_68 AC 1,269 ms
7,708 KB
testcase_69 AC 1,266 ms
7,676 KB
testcase_70 AC 1,198 ms
7,644 KB
testcase_71 AC 1,202 ms
7,624 KB
testcase_72 AC 840 ms
7,184 KB
testcase_73 AC 1,774 ms
8,280 KB
testcase_74 AC 1,767 ms
8,300 KB
testcase_75 AC 130 ms
6,388 KB
testcase_76 AC 1,252 ms
7,740 KB
testcase_77 AC 511 ms
6,848 KB
testcase_78 AC 1,543 ms
8,088 KB
testcase_79 AC 1,276 ms
7,700 KB
testcase_80 AC 1,452 ms
7,924 KB
testcase_81 AC 1,203 ms
7,648 KB
testcase_82 AC 35 ms
6,316 KB
testcase_83 AC 494 ms
6,876 KB
testcase_84 AC 531 ms
6,828 KB
testcase_85 AC 1,082 ms
7,544 KB
testcase_86 AC 1,474 ms
7,932 KB
testcase_87 AC 2,076 ms
8,600 KB
testcase_88 AC 2,075 ms
8,520 KB
権限があれば一括ダウンロードができます

ソースコード

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++) {
        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