Created
March 7, 2020 13:12
-
-
Save gus3inov/3a386d3d078c5cf94c04d94018fa323f to your computer and use it in GitHub Desktop.
Codeforces Rust Scanner (https://codeforces.com/blog/entry/67391)
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() { | |
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(); | |
} | |
} |
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::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