Problem:
Score : 400 points

Problem Statement

You are given an integer N. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many Shichi-Go numbers (literally "Seven-Five numbers") are there?

Here, a Shichi-Go number is a positive integer that has exactly 75 divisors.

Note

When a positive integer A divides a positive integer B, A is said to a divisor of B.
For example, 6 has four divisors: 1, 2, 3 and 6.

Constraints

1 \leq N \leq 100

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of the Shichi-Go numbers that are divisors of N!.

Sample Input 1

9

Sample Output 1

0

There are no Shichi-Go numbers among the divisors of 9! = 1 \times 2 \times ... \times 9 = 362880.

Sample Input 2

10

Sample Output 2

1

There is one Shichi-Go number among the divisors of 10! = 3628800: 32400.

Sample Input 3

100

Sample Output 3

543

Solution in Rust (1.42.0) (judge verdict: Accepted)

#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
// use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
       N:usize
    }
    // 約数の個数は素因数分解して、各素因数の個数+1をかけたもの。
    // Ex: 12= 2^2*3^1なので、(2+1)*(1+1)=6個。1,2,3,4,6,12
    // 75=(2+1)*(4+1)*(4+1);
    // 100以下の素数は97までの25個。
    // 素数a,b,cについて、a<b<cとする。
    // N < c*2なら、cは N! に高々1個しか含まれないので、不可。
    // 同様に、N < b*4 も成立しない。
    // cの可能性があるのはN/2以下、a,bの可能性があるのはN/4
    let p = getPrimes(N);
    let mut ans = 0;
    //    let ts = getNumbersInN(N);
    let mut ts = vec![0; N + 1];
    for i in 0..p.len() {
        for j in p[i]..=N {
            let mut t = j;
            while t % p[i] == 0 {
                ts[p[i]] += 1;
                t = t / p[i];
            }
        }
    }
    //println!("{:?}", ts);
    let num = |m| {
        let mut s = 0;
        for &t in ts.iter() {
            if t >= m - 1 {
                s += 1;
            }
        }
        s
    };
    // 2個,4個,4個の場合
    // choose(num5,2) * (num3-num5) + 3*choose(num5,3)
    // = num5*(num5-1)*(num3-num5)/2 + num5*(num5-1)*(num5-2)/2
    // = num5*(num5-1)*(num3 -num5 +num5-2)/2
    // = num5*(num5-1)*(num3-2)/2
    ans += num(5) * (num(5) - 1) * (num(3) - 2) / 2;

    // 14,4の場合
    for i in 0..p.len() {
        let t = ts[p[i]];
        if t < 14 {
            break;
        }
        for j in (i + 1)..p.len() {
            let b = p[j];
            let t2 = ts[p[j]];
            if t2 < 4 {
                break;
            }
            if t2 < 14 {
                ans += 1;
            } else {
                ans += 2;
            }
        }
    }
    //print!("{} ", ans);

    // 24,2の場合
    for i in 0..p.len() {
        let t = ts[p[i]];
        if t < 24 {
            break;
        }
        for j in (i + 1)..p.len() {
            let t2 = ts[p[j]];
            if t2 < 2 {
                break;
            }
            if t2 < 24 {
                ans += 1;
            } else {
                ans += 2;
            }
        }
    }
    //print!("{} ", ans);
    // 74の場合
    ans += num(75);
    println!("{}", ans);
}
fn getPrimes(N: usize) -> Vec<usize> {
    let mut p = vec![true; N as usize + 1];
    let mut q = Vec::with_capacity(100);
    p[0] = false;
    p[1] = false;
    for i in 2..=N as usize {
        if p[i as usize] {
            q.push(i);
        }
        let mut j = 2;
        while i * j <= N {
            p[(i * j) as usize] = false;
            j += 1;
        }
    }
    q
}
// 75-1以上=1
// 25-1以上=3
// 15-1以上=4
// 5-1以上=9
// 3-1以上=15
// 1 + 4*48 + 6*23 + 24*23*47/2 = 1+192+138+12972
// 1 + 3*14 + 4*8 + 9*8*13/2 = 1+42+32+468=543

//[0, 97, 48, x32, 24,x18, 16, x13, x12, x11,
//  9,x8, 7,x7,x6,x6, 5,x5, 5, x5,
// x4,x4, 4,x4,x4,x3,x3,x3, 3,x3,
//  3,x3,x3,x2,x2,x2, 2,x2,x2,x2,
//  2,x2, 2,x2,x2,x2, 2,x2,x2,x2,
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]