Skip to content

Instantly share code, notes, and snippets.

@icub3d
Created December 5, 2025 19:43
Show Gist options
  • Select an option

  • Save icub3d/6852b3654b6b5d671b5c015302b2469f to your computer and use it in GitHub Desktop.

Select an option

Save icub3d/6852b3654b6b5d671b5c015302b2469f to your computer and use it in GitHub Desktop.
Kattis eligibility
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
for m in s.lines().skip(1) {
let pp = m.split_whitespace().collect::<Vec<_>>();
let (name, studies, dob, courses) = (
pp[0],
pp[1][..4].parse::<usize>().unwrap(),
pp[2][..4].parse::<usize>().unwrap(),
pp[3].parse::<usize>().unwrap(),
);
if studies >= 2010 || dob >= 1991 {
println!("{name} eligible");
} else if courses >= 41 {
println!("{name} ineligible");
} else {
println!("{name} coach petitions");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment