Skip to content

Instantly share code, notes, and snippets.

@icub3d
Created December 14, 2025 02:26
Show Gist options
  • Select an option

  • Save icub3d/7bf311611dcd0d85330b2f30f4460698 to your computer and use it in GitHub Desktop.

Select an option

Save icub3d/7bf311611dcd0d85330b2f30f4460698 to your computer and use it in GitHub Desktop.
Kattis statistics
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
for (i, m) in s.lines().enumerate() {
let vv = m
.split_whitespace()
.skip(1)
.map(|v| v.parse::<isize>().unwrap())
.collect::<Vec<_>>();
let min = vv.iter().min().unwrap();
let max = vv.iter().max().unwrap();
println!("Case {}: {} {} {}", i + 1, min, max, max - min);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment