結果

問題 No.597 concat
ユーザー aimy
提出日時 2017-11-24 22:22:00
言語 Rust
(1.37.0)
結果
AC  
実行時間 2 ms
コード長 2,224 Byte
コンパイル時間 1,246 ms
使用メモリ 960 KB
最終ジャッジ日時 2019-10-12 07:50:28

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
0_sample_0.txt AC 2 ms
956 KB
0_sample_1.txt AC 1 ms
956 KB
0_sample_2.txt AC 2 ms
956 KB
1_case_0.txt AC 1 ms
956 KB
1_case_1.txt AC 2 ms
960 KB
1_case_2.txt AC 2 ms
956 KB
1_case_3.txt AC 2 ms
960 KB
1_case_4.txt AC 2 ms
960 KB
1_case_5.txt AC 2 ms
960 KB
1_case_6.txt AC 2 ms
960 KB
1_case_7.txt AC 2 ms
960 KB
1_case_8.txt AC 2 ms
960 KB
1_case_9.txt AC 2 ms
956 KB
2_case_0.txt AC 2 ms
960 KB
テストケース一括ダウンロード
コンパイルメッセージ
warning: use of deprecated item 'core::str::<impl str>::trim_right': superseded by `trim_end`
  --> Main.rs:20:9
   |
20 |     buf.trim_right().parse::<T>().ok().unwrap()
   |         ^^^^^^^^^^ help: replace the use of the deprecated item: `trim_end`
   |
   = note: #[warn(deprecated)] on by default

warning: use of deprecated item 'core::str::<impl str>::trim_right': superseded by `trim_end`
  --> Main.rs:35:22
   |
35 |     let mut it = buf.trim_right().split_whitespace();
   |                      ^^^^^^^^^^ help: replace the use of the deprecated item: `trim_end`

warning: use of deprecated item 'core::str::<impl str>::trim_right': superseded by `trim_end`
  --> Main.rs:53:22
   |
53 |     let mut it = buf.trim_right().split_whitespace();
   |                      ^^^^^^^^^^ help: replace the use of the deprecated item: `trim_end`

warning: use of deprecated item 'core::str::<impl str>::trim_right': superseded by `trim_end`
  --> Main.rs:72:9
   |
72 |     buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
   |         ^^^^^^^^^^ help: replace the use of the deprecated item: `trim_end`

warning: use of deprecated item 'core::str::<impl str>::trim_right': superseded by `trim_end`
  --> Main.rs:87:9
   |
87 |     buf.trim_right().chars().collect()
   |         ^^^^^^^^^^ help: replace the use of the deprecated item: `trim_end`

ソースコード

diff #
fn main() {
  let n = get::val::<usize>();
  let ss = get::vals::<String>(n);

  for s in ss {
    print!("{}", s)
  }
  println!("")
}

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}
0