提出 #59442550


ソースコード 拡げる

// -*- coding:utf-8-unix -*-

use proconio::input;

fn get_exponential_nums(base: usize, max: usize) -> Vec<usize> {
    let mut nums = vec![];
    for i in 2..=max {
        let n = base.pow(i as u32);
        if n > max {
            break;
        }
        nums.push(n);
    }
    nums
}

fn main() {
    input! {
        x: usize,
    }
    // 31^2 = 961 なのでそこまで準備しておけば十分
    let result = (1..=35)
        .map(|b| {
            if b == 1 {
                vec![1]
            } else {
                get_exponential_nums(b, x)
            }
        })
        .flatten()
        .max()
        .unwrap();

    println!("{}", result);
}

提出情報

提出日時
問題 B - Exponential
ユーザ homura10059
言語 Rust (rustc 1.70.0)
得点 200
コード長 710 Byte
結果 AC
実行時間 1 ms
メモリ 2080 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 9
セット名 テストケース
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
ケース名 結果 実行時間 メモリ
0_000.txt AC 1 ms 1964 KiB
0_001.txt AC 1 ms 1992 KiB
0_002.txt AC 0 ms 2080 KiB
1_003.txt AC 0 ms 1988 KiB
1_004.txt AC 0 ms 1796 KiB
1_005.txt AC 0 ms 2064 KiB
1_006.txt AC 0 ms 1916 KiB
1_007.txt AC 1 ms 1964 KiB
1_008.txt AC 0 ms 2036 KiB