結果

問題 No.1664 Unstable f(n)
ユーザー ziitaziita
提出日時 2021-09-03 21:38:30
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 2,038 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 152,196 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-21 20:26:22
合計ジャッジ時間 3,821 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
4,384 KB
testcase_01 AC 28 ms
4,380 KB
testcase_02 AC 14 ms
4,384 KB
testcase_03 AC 13 ms
4,384 KB
testcase_04 AC 14 ms
4,380 KB
testcase_05 AC 13 ms
4,384 KB
testcase_06 AC 13 ms
4,380 KB
testcase_07 AC 14 ms
4,380 KB
testcase_08 AC 13 ms
4,384 KB
testcase_09 AC 13 ms
4,384 KB
testcase_10 AC 13 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 27 ms
4,380 KB
testcase_22 AC 27 ms
4,380 KB
testcase_23 AC 27 ms
4,384 KB
testcase_24 AC 27 ms
4,380 KB
testcase_25 AC 27 ms
4,380 KB
testcase_26 AC 13 ms
4,380 KB
testcase_27 AC 13 ms
4,384 KB
testcase_28 AC 13 ms
4,380 KB
testcase_29 AC 14 ms
4,380 KB
testcase_30 AC 13 ms
4,384 KB
testcase_31 AC 27 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 27 ms
4,388 KB
testcase_34 AC 24 ms
4,384 KB
testcase_35 WA -
testcase_36 AC 27 ms
4,384 KB
testcase_37 WA -
testcase_38 AC 13 ms
4,380 KB
testcase_39 AC 28 ms
4,384 KB
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::io::Write;
use std::collections::*;
use std::cmp::*;
use std::ops::*;
use std::marker::*;

const INF: i64 = std::i64::MAX/100;
const MOD: i64 = 1_000_000_007;
// const MOD: i64 = 998244353;

fn main() {
    input! {
        n: (i64),
    }
    let mut ans = n;
    for i in 2..=10000000 {
        let mut base = i;
        for j in 1..=50 {
            if base > n {
                break;
            }
            let k = n - base;
            ans = ans.min(i+j+k);
            base *= i;
        }
    }
    println!("{}",ans);
}
0