Created
December 5, 2025 19:43
-
-
Save icub3d/6852b3654b6b5d671b5c015302b2469f to your computer and use it in GitHub Desktop.
Kattis eligibility
This file contains hidden or 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
| 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