Submission #45053235


Source Code Expand

use proconio::input;

fn prime_factorization(n: usize) -> Vec<(usize, usize)> {
    let mut p = vec![];
    if n < 2 {
        return p;
    }
    let mut n = n; // shadowing
    for i in 2.. {
        if i * i > n {
            break;
        }
        let mut c = 0;
        while n % i == 0 {
            c += 1;
            n /= i;
        }
        if c > 0 {
            p.push((i, c));
        }
    }
    if n != 1 {
        p.push((n, 1));
    }
    p
}

fn main() {
    input! {
        n: usize,
    };
    let ps = prime_factorization(n);
    let mut ans = 0_usize;
    for (_, q) in ps {
        let mut count = 0_usize;
        let mut sum = 0_usize;
        for i in 1..=q {
            sum += i;
            if sum > q {
                break;
            }
            count += 1;
        }
        ans += count;
    }
    println!("{}", ans);
}

Submission Info

Submission Time
Task D - Div Game
User bouzuya
Language Rust (1.42.0)
Score 400
Code Size 863 Byte
Status AC
Exec Time 19 ms
Memory 2100 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 5
AC × 32
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, hand_17.txt, hand_18.txt, hand_19.txt, hand_20.txt, hand_21.txt, hand_22.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
Case Name Status Exec Time Memory
hand_01.txt AC 7 ms 2032 KiB
hand_02.txt AC 2 ms 1964 KiB
hand_03.txt AC 2 ms 2080 KiB
hand_04.txt AC 2 ms 2028 KiB
hand_05.txt AC 2 ms 2012 KiB
hand_06.txt AC 2 ms 1968 KiB
hand_07.txt AC 2 ms 2020 KiB
hand_08.txt AC 1 ms 2032 KiB
hand_09.txt AC 14 ms 1964 KiB
hand_10.txt AC 15 ms 2028 KiB
hand_11.txt AC 15 ms 2092 KiB
hand_12.txt AC 14 ms 2040 KiB
hand_13.txt AC 13 ms 2020 KiB
hand_14.txt AC 15 ms 2036 KiB
hand_15.txt AC 2 ms 1964 KiB
hand_16.txt AC 3 ms 2016 KiB
hand_17.txt AC 2 ms 2024 KiB
hand_18.txt AC 2 ms 1972 KiB
hand_19.txt AC 2 ms 2012 KiB
hand_20.txt AC 2 ms 2028 KiB
hand_21.txt AC 19 ms 2092 KiB
hand_22.txt AC 2 ms 2032 KiB
random_01.txt AC 2 ms 2036 KiB
random_02.txt AC 2 ms 2012 KiB
random_03.txt AC 2 ms 2092 KiB
random_04.txt AC 11 ms 1896 KiB
random_05.txt AC 2 ms 2036 KiB
sample_01.txt AC 2 ms 2048 KiB
sample_02.txt AC 2 ms 1980 KiB
sample_03.txt AC 2 ms 2100 KiB
sample_04.txt AC 2 ms 2040 KiB
sample_05.txt AC 2 ms 2088 KiB