Submission #3704336


Source Code Expand

#
# File    : D.rb
# Author  : Kazune Takahashi
# Created : 2018-12-2 21:13:23
# Powered by Visual Studio Code
#

require 'prime'

n = gets.to_i

hash = {}

for i in 2...100
  if Prime.prime?(i)
    hash[i] = 0
  end
end

for i in 1..n
  num = i
  hash.each{|prime, cnt|
    while num % prime == 0
      num /= prime
      hash[prime] += 1
    end
  }
end

# p hash

ary = Array.new(100){0}

hash.each{|prime, cnt|
  ary[cnt] += 1
}

for i in 0...99
  ary[98 - i] += ary[99 - i]
end

ans = 0
ans += ary[74]
ans += ary[4] * ary[14] - ary[14]
ans += ary[2] * ary[24] - ary[24]
ans += (ary[2] - 2) * ary[4] * (ary[4] - 1) / 2

puts ans

Submission Info

Submission Time
Task D - 756
User kazunetakahashi
Language Ruby (2.3.3)
Score 400
Code Size 681 Byte
Status AC
Exec Time 35 ms
Memory 2044 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 20
Set Name Test Cases
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
Case Name Status Exec Time Memory
a01 AC 35 ms 2044 KB
a02 AC 10 ms 1916 KB
a03 AC 11 ms 1916 KB
b04 AC 10 ms 1916 KB
b05 AC 10 ms 1916 KB
b06 AC 10 ms 1916 KB
b07 AC 10 ms 1916 KB
b08 AC 10 ms 1916 KB
b09 AC 10 ms 1916 KB
b10 AC 10 ms 1916 KB
b11 AC 10 ms 1916 KB
b12 AC 10 ms 1916 KB
b13 AC 10 ms 1916 KB
b14 AC 10 ms 1916 KB
b15 AC 10 ms 1916 KB
b16 AC 10 ms 1916 KB
b17 AC 10 ms 1916 KB
b18 AC 10 ms 1916 KB
b19 AC 10 ms 1916 KB
b20 AC 10 ms 1916 KB