結果
| 問題 | 
                            No.46 はじめのn歩
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-02-17 00:31:28 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 2,119 bytes | 
| コンパイル時間 | 13,793 ms | 
| コンパイル使用メモリ | 377,820 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-30 01:37:34 | 
| 合計ジャッジ時間 | 14,634 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
warning: unused import: `std::io::BufRead`
  --> src/main.rs:13:13
   |
13 |         use std::io::BufRead;
   |             ^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default
warning: methods `nl` and `ns` are never used
  --> src/main.rs:56:8
   |
5  | impl<BR: std::io::BufRead> Scanner<BR> {
   | -------------------------------------- methods in this implementation
...
56 |     fn nl(&mut self) -> i64 {
   |        ^^
...
60 |     fn ns(&mut self) -> String {
   |        ^^
   |
   = note: `#[warn(dead_code)]` on by default
            
            ソースコード
struct Scanner<BR: std::io::BufRead> {
    buf_read: BR,
}
impl<BR: std::io::BufRead> Scanner<BR> {
    fn new(buf_read: BR) -> Scanner<BR> {
        Scanner { buf_read: buf_read }
    }
    fn read_until_f<P>(&mut self, predicate: P) -> std::io::Result<String> where
        P: std::ops::Fn(&u8) -> bool,
    {
        use std::io::BufRead;
        let mut buf = std::vec::Vec::new();
        loop {
            let (done, used) = {
                let available: &[u8] = match self.buf_read.fill_buf() {
                    Ok(b) => b,
                    Err(ref e) if e.kind() == std::io::ErrorKind::Interrupted => continue,
                    Err(e) => return Err(e),
                };
                match available.iter().position(&predicate) {
                    Some(i) => {
                        buf.extend_from_slice(&available[..i + 1]);
                        (true, i + 1)
                    }
                    None => {
                        buf.extend_from_slice(available);
                        (false, available.len())
                    }
                }
            };
            self.buf_read.consume(used);
            if done || used == 0 {
                return match String::from_utf8(buf) {
                    Ok(s) => Ok(s),
                    Err(_) => Err(std::io::Error::new(std::io::ErrorKind::InvalidInput, "error")),
                }
            }
        }
    }
    fn next<T: std::str::FromStr>(&mut self) -> T where
        < T as std::str::FromStr >::Err: std::fmt::Debug
    {
        use ::std::str::FromStr;
        let mut with_delim = self.read_until_f(|&c| { c == b' ' || c == b'\n' }).unwrap();
        with_delim.pop();
        FromStr::from_str(with_delim.as_str()).unwrap()
    }
    fn ni(&mut self) -> i32 {
        self.next()
    }
    fn nl(&mut self) -> i64 {
        self.next()
    }
    fn ns(&mut self) -> String {
        self.next()
    }
}
fn main() {
    let stdin = std::io::stdin();
    let mut scanner = Scanner::new(stdin.lock());
    let a = scanner.ni();
    let b = scanner.ni();
    println!("{}", (b + a - 1) / a)
}