Last active
August 16, 2020 07:30
-
-
Save yasukotelin/d9394fdc180284726ef5645bb1e7e0d3 to your computer and use it in GitHub Desktop.
Rust 競技プログラミング用テンプレート
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
} | |
fn read<T: std::str::FromStr>() -> T { | |
let mut s = String::new(); | |
std::io::stdin().read_line(&mut s).ok(); | |
s.trim().parse().ok().unwrap() | |
} | |
fn read_vec<T: std::str::FromStr>() -> Vec<T> { | |
read::<String>() | |
.split_whitespace() | |
.map(|e| e.parse().ok().unwrap()) | |
.collect() | |
} | |
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> { | |
(0..n).map(|_| read_vec()).collect() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考: [Qiita: https://qiita.com/penguinshunya/items/cd96803b74635aebefd6]