Last active
January 11, 2023 09:43
-
-
Save lordofwizard/2cc90c54095ff4835fc93dc9b62eb316 to your computer and use it in GitHub Desktop.
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
#[allow(unused_imports)] | |
use std::io; | |
use std::str::FromStr; | |
fn main() { | |
let mut scanner = Scanner::default(); | |
let t = scanner.next::<u64>(); | |
for _ in 0..t{ | |
solve(); | |
} | |
} | |
fn solve(){ | |
let mut s = Scanner::default(); | |
} | |
#[derive(Default)] | |
struct Scanner { | |
input: Vec<String>, | |
} | |
#[allow(dead_code)] | |
impl Scanner { | |
fn next<T: FromStr>(&mut self) -> T { | |
loop { | |
if let Some(value) = self.input.pop() { | |
return value.parse().ok().expect("Failed at parsing!"); | |
} | |
let mut input = String::new(); | |
io::stdin() | |
.read_line(&mut input) | |
.expect("Failed at taking inputs"); | |
self.input = input | |
.trim() | |
.split_whitespace() | |
.rev() | |
.map(String::from) | |
.collect(); | |
} | |
} | |
fn int(&mut self) -> i64 { | |
loop { | |
if let Some(value) = self.input.pop() { | |
return value.parse().ok().expect("Failed at parsing!"); | |
} | |
let mut input = String::new(); | |
io::stdin() | |
.read_line(&mut input) | |
.expect("Failed at taking inputs"); | |
self.input = input | |
.trim() | |
.split_whitespace() | |
.rev() | |
.map(String::from) | |
.collect(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment