提出 #3706086


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

map<int,int> prime_factor(int n) {
  map<int,int> ret;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ++ret[i];
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

vector<int> d(101,0);
int c_2, c_4, c_14, c_24, c_74;

signed main() {

  int N;
  cin >> N;

  for (int i = 1; i <= N; ++i) {
    auto p_f = prime_factor(i);
    for (auto itr=p_f.begin(); itr!=p_f.end(); ++itr) {
      d[itr->first] += itr->second;
    }
  }

  for (auto& e : d) {
    if (e >=  2)  c_2++;
    if (e >=  4)  c_4++;
    if (e >= 14) c_14++;
    if (e >= 24) c_24++;
    if (e >= 74) c_74++;
  }

  int res = 0;
  // a^2 * b^4 * c^4 -> C(c_4,2) * (c_2 - 2)
  res += max(0,c_4*(c_4-1)/2*(c_2-2));
  // a^2 * b^24 -> c_24 * (c_2 - 1)
  res += max(0,c_24*(c_2-1));
  // a^4 * b^14 -> c_14 * (c_4 - 1)
  res += max(0,c_14*(c_4-1));
  // a^74
  res += c_74;
  cout << res << endl;

}

提出情報

提出日時
問題 D - 756
ユーザ morio__
言語 C++14 (GCC 5.4.1)
得点 400
コード長 943 Byte
結果 AC
実行時間 1 ms
メモリ 256 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 20
セット名 テストケース
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20
ケース名 結果 実行時間 メモリ
a01 AC 1 ms 256 KiB
a02 AC 1 ms 256 KiB
a03 AC 1 ms 256 KiB
b04 AC 1 ms 256 KiB
b05 AC 1 ms 256 KiB
b06 AC 1 ms 256 KiB
b07 AC 1 ms 256 KiB
b08 AC 1 ms 256 KiB
b09 AC 1 ms 256 KiB
b10 AC 1 ms 256 KiB
b11 AC 1 ms 256 KiB
b12 AC 1 ms 256 KiB
b13 AC 1 ms 256 KiB
b14 AC 1 ms 256 KiB
b15 AC 1 ms 256 KiB
b16 AC 1 ms 256 KiB
b17 AC 1 ms 256 KiB
b18 AC 1 ms 256 KiB
b19 AC 1 ms 256 KiB
b20 AC 1 ms 256 KiB