Skip to content

Commit

Permalink
feat(stomp): start on rust cp template
Browse files Browse the repository at this point in the history
  • Loading branch information
vEnhance committed Aug 22, 2024
1 parent af1c5dc commit 01f276b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions ioi-template.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Template based on https://codeforces.com/blog/entry/67391
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, BufWriter, 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("oh no failed to parse");
}
let mut input = String::new();
stdin().read_line(&mut input).expect("eep i failed to read");
self.buffer = input.split_whitespace().rev().map(String::from).collect();
}
}
}

#[allow(dead_code)]
fn main() {
let mut scan = Scanner::default();
let out = &mut BufWriter::new(stdout());

// write your program here, e.g.
let n: i32 = scan.next();
writeln!(out, "{}", n).ok();
}

0 comments on commit 01f276b

Please sign in to comment.