Skip to content

Instantly share code, notes, and snippets.

@gus3inov
Created March 7, 2020 13:12
Show Gist options
  • Save gus3inov/3a386d3d078c5cf94c04d94018fa323f to your computer and use it in GitHub Desktop.
Save gus3inov/3a386d3d078c5cf94c04d94018fa323f to your computer and use it in GitHub Desktop.
Codeforces Rust Scanner (https://codeforces.com/blog/entry/67391)
fn main() {
let mut scan = Scanner::default();
let out = &mut BufWriter::new(stdout());
let n = scan.next::<usize>();
let q = scan.next::<usize>();
if n > q {
writeln!(out, "Shi").ok();
} else {
writeln!(out, "Fou").ok();
}
}
#[allow(unused_imports)]
use std::cmp::{min,max};
use std::io::{BufWriter, stdin, stdout, Write};
#[derive(Default)]
struct Scanner {
buffer: Vec<String>
}
impl Scanner {
fn next<T: std::str::FromStr>(&mut self) -> T {
loop {
if let Some(token) = self.buffer.pop() {
return token.parse().ok().expect("Failed parse");
}
let mut input = String::new();
stdin().read_line(&mut input).expect("Failed read");
self.buffer = input.split_whitespace().rev().map(String::from).collect();
}
}
}
fn main() {
let mut scan = Scanner::default();
let n = scan.next::<String>();
let q = scan.next::<String>();
let a: Vec<usize> = (0..n).map(|_| scan.next()).collect();
println!("{}, {}", n, q);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment