結果

問題 No.46 はじめのn歩
ユーザー kn_rew
提出日時 2025-01-06 22:45:52
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 1,175 bytes
コンパイル時間 13,348 ms
コンパイル使用メモリ 400,996 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-06 22:46:07
合計ジャッジ時間 11,434 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;
use reprol::math::div_ceil::DivCeil;

fn main() {
    input! {
        a: i64,
        b: i64,
    }
    let ans = b.div_ceil_(a);
    println!("{}", ans);
}

#[allow(dead_code)]
mod reprol {
    pub mod math {
        pub mod div_ceil {
            pub trait DivCeil {
                fn div_ceil_(self, rhs: Self) -> Self;
            }
            macro_rules! impl_integer {
                ($($ty:ident),*) => {$(
                    impl DivCeil for $ty {
                        #[allow(unused_comparisons)]
                        fn div_ceil_(self, rhs: Self) -> Self {
                            debug_assert!(self >= 0);
                            debug_assert!(rhs >= 1);
                            let d = self / rhs;
                            let r = self % rhs;
                            if r > 0 {
                                d + 1
                            } else {
                                d
                            }
                        }
                    }
                )*};
            }
            impl_integer! { u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize }
        }
    }
}
0