結果

問題 No.2450 99-like Number
ユーザー masookamasooka
提出日時 2023-09-03 02:26:41
言語 Rust
(1.77.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 8,477 bytes
コンパイル時間 14,359 ms
コンパイル使用メモリ 382,332 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 07:19:35
合計ジャッジ時間 15,525 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

pub use sub::prelude::*;

use crate::sub::macros::input::*;

fn main() {
    input! {
        n: String,
    }

    if n.chars().all(|c| c == '9') {
        println!("Yes");
    } else {
        println!("No");
    }
}

#[allow(unused)]
mod sub {
    pub(crate) mod crates {
        pub mod input {
            pub use crate::sub::macros::input::*;
            use std::{
                cell::RefCell,
                fmt::Debug,
                io::{self, BufRead, Read},
                rc::Rc,
                str::{FromStr, SplitWhitespace},
            };

            #[macro_export]
            macro_rules!          sub_macro_def_input_input {
                (from $scanner:ident; $($tt:tt)*) => {
                    $crate::sub::crates::input::__input_inner!(@scanner($scanner), @tts($($tt)*))
                };
                ($($tt:tt)*) => {
                    let __scanner = $crate::sub::crates::input::DEFAULT_SCANNER.with(|__scanner| __scanner.clone());
                    let mut __scanner_ref = __scanner.borrow_mut();
                    if let $crate::sub::crates::input::Scanner::Uninited = *__scanner_ref {
                        *__scanner_ref = $crate::sub::crates::input::Scanner::stdin_auto().unwrap();
                    }
                    $crate::sub::crates::input::__input_inner!(@scanner(__scanner_ref), @tts($($tt)*));
                    ::std::mem::drop(__scanner_ref);
                    ::std::mem::drop(__scanner);
                };
            }
            macro_rules!input{($($tt:tt)*)=>(crate::sub_macro_def_input_input!{$($tt)*})}

            #[macro_export]
            macro_rules!                  sub_macro_def_input___input_inner {
                (@scanner($scanner:ident), @tts()) => {};
                (@scanner($scanner:ident), @tts(mut $single_tt_pat:tt : $readable:tt)) => {
                    let mut $single_tt_pat = $crate::sub::crates::input::__read!(from $scanner { $readable });
                };
                (@scanner($scanner:ident), @tts($single_tt_pat:tt : $readable:tt)) => {
                    let $single_tt_pat = $crate::sub::crates::input::__read!(from $scanner { $readable });
                };
                (@scanner($scanner:ident), @tts(mut $single_tt_pat:tt : $readable:tt, $($rest:tt)*)) => {
                    $crate::sub::crates::input::__input_inner!(@scanner($scanner), @tts(mut $single_tt_pat: $readable));
                    $crate::sub::crates::input::__input_inner!(@scanner($scanner), @tts($($rest)*));
                };
                (@scanner($scanner:ident), @tts($single_tt_pat:tt : $readable:tt, $($rest:tt)*)) => {
                    $crate::sub::crates::input::__input_inner!(@scanner($scanner), @tts($single_tt_pat: $readable));
                    $crate::sub::crates::input::__input_inner!(@scanner($scanner), @tts($($rest)*));
                };
            }
            macro_rules!__input_inner{($($tt:tt)*)=>(crate::sub_macro_def_input___input_inner!{$($tt)*})}

            #[macro_export]
            macro_rules!           sub_macro_def_input___read {
                (from $scanner:ident { [$tt:tt] }) => {
                    $crate::sub::crates::input::__read!(from $scanner { [$tt; $crate::sub::crates::input::__read!(from $scanner { usize })] })
                };
                (from $scanner:ident  { [$tt:tt; $n:expr] }) => {
                    (0..$n).map(|_| $crate::sub::crates::input::__read!(from $scanner { $tt })).collect::<Vec<_>>()
                };
                (from $scanner:ident { ($($tt:tt),+) }) => {
                    ($($crate::sub::crates::input::__read!(from $scanner { $tt })),*)
                };
                (from $scanner:ident { { $f:expr } }) => {
                    $crate::sub::crates::input::FnOnceExt::<_>::call_once_from_reader($f, &mut $scanner)
                };
                (from $scanner:ident { $ty:ty }) => {
                    <$ty as $crate::sub::crates::input::Readable>::read(|| $scanner.next_unwrap())
                };
            }
            macro_rules!__read{($($tt:tt)*)=>(crate::sub_macro_def_input___read!{$($tt)*})}

            #[deprecated(note = "Use `Usize1` instead")]
            #[inline]
            pub fn usize1(n: usize) -> usize {
                n - 1
            }

            #[deprecated(note = "Use `Bytes` instead")]
            #[inline]
            pub fn bytes(s: String) -> Vec<u8> {
                s.into()
            }

            pub trait FnOnceExt<A> {
                type Output;
                fn call_once_from_reader(this: Self, scanner: &mut Scanner) -> Self::Output;
            }

            impl<A, O, F> FnOnceExt<A> for F
            where
                A: FromStr,
                A::Err: Debug,
                F: FnOnce(A) -> O,
            {
                type Output = O;

                #[inline]
                fn call_once_from_reader(this: Self, scanner: &mut Scanner) -> O {
                    this(scanner.next_unwrap().parse().unwrap())
                }
            }

            pub enum Scanner {
                Uninited,
                Once {
                    words: SplitWhitespace<'static>,
                },
                Lines {
                    rdr: Box<dyn BufRead>,
                    words: SplitWhitespace<'static>,
                },
            }

            impl Scanner {
                pub fn stdin_auto() -> io::Result<Self> {
                    if cfg!(debug_assertions) {
                        Ok(Self::lines(Box::leak(Box::new(io::stdin())).lock()))
                    } else {
                        Self::once(io::stdin())
                    }
                }

                pub fn once<R: Read>(mut rdr: R) -> io::Result<Self> {
                    let mut buf = String::with_capacity(1024);
                    rdr.read_to_string(&mut buf)?;
                    let words = Box::leak(buf.into_boxed_str()).split_whitespace();
                    Ok(Self::Once { words })
                }

                pub fn lines<R: BufRead + 'static>(rdr: R) -> Self {
                    Self::Lines {
                        rdr: Box::new(rdr),
                        words: "".split_whitespace(),
                    }
                }

                pub fn next_unwrap(&mut self) -> &'static str {
                    match self {
                        Self::Uninited => None,
                        Self::Once { words } => words.next(),
                        Self::Lines { rdr, words } => words.next().or_else(|| {
                            let mut line = "".to_owned();
                            rdr.read_line(&mut line).unwrap();
                            *words = Box::leak(line.into_boxed_str()).split_whitespace();
                            words.next()
                        }),
                    }
                    .expect("reached EOF")
                }
            }

            thread_local! {
                #[doc(hidden)]
                pub static DEFAULT_SCANNER: Rc<RefCell<Scanner>> = Rc::new(RefCell::new(Scanner::Uninited));
            }

            pub trait Readable {
                type Output;

                fn read<'a, F: FnMut() -> &'a str>(get: F) -> Self::Output;
            }

            impl<T: FromStr> Readable for T
            where
                T::Err: Debug,
            {
                type Output = Self;

                fn read<'a, F: FnMut() -> &'a str>(mut get: F) -> Self {
                    get().parse().unwrap()
                }
            }

            pub enum Usize1 {}

            impl Readable for Usize1 {
                type Output = usize;

                fn read<'a, F: FnMut() -> &'a str>(get: F) -> usize {
                    usize::read(get) - 1
                }
            }

            pub enum Bytes {}

            impl Readable for Bytes {
                type Output = Vec<u8>;

                fn read<'a, F: FnMut() -> &'a str>(mut get: F) -> Vec<u8> {
                    get().into()
                }
            }
        }
    }

    pub(crate) mod macros {
        pub mod input {
            pub use crate::{
                sub_macro_def_input___input_inner as __input_inner,
                sub_macro_def_input___read as __read, sub_macro_def_input_input as input,
            };
        }
    }

    pub(crate) mod prelude {
        pub use crate::sub::crates::*;
    }

    mod preludes {
        pub mod input {}
    }
}
0