Last active
August 18, 2017 22:40
-
-
Save gyu-don/9ad5bc11c433983c3803a24139e7ba03 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#![allow(unused_macros, unused_imports, dead_code)] | |
use std::io::*; | |
use std::collections::*; | |
fn read_line() -> String { | |
let mut s = String::new(); | |
stdin().read_line(&mut s).unwrap(); | |
s | |
} | |
macro_rules! from_iter { | |
($($a:ident),+ = $it:expr) => { | |
$(let $a;)+ | |
{ | |
let mut _it = $it.into_iter(); | |
$($a = _it.next().unwrap();)+ | |
assert!(_it.next().is_none()); | |
} | |
}; | |
} | |
macro_rules! from_str { | |
($($a:ident : $t:ty),+ = $s:expr) => { | |
$(let $a: $t;)+ | |
{ | |
let mut _it = $s.split_whitespace(); | |
$($a = _it.next().unwrap().parse().unwrap();)+ | |
assert!(_it.next().is_none()); | |
} | |
}; | |
} | |
macro_rules! from_line { | |
($($a:ident : $t:ty),+) => { | |
$(let $a: $t;)+ | |
{ | |
let _line = read_line(); | |
let mut _it = _line.trim().split_whitespace(); | |
$($a = _it.next().unwrap().parse().unwrap();)+ | |
assert!(_it.next().is_none()); | |
} | |
}; | |
} | |
macro_rules! print_var_fmt { | |
($e:expr) => { | |
concat!(stringify!($e), ":\t{}") | |
}; | |
($e:expr, $($es: expr),+) => { | |
concat!(print_var_fmt!($e), ",\t", print_var_fmt!($($es),+)) | |
}; | |
} | |
macro_rules! dbg { | |
($($es:expr),+) => { | |
writeln!(&mut io::stderr(), print_var_fmt!($($es),*), $($es),*); | |
}; | |
} | |
fn main() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment