Skip to content

Instantly share code, notes, and snippets.

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

  • Save icub3d/9e9d77b337d542415fbceafd936e1b31 to your computer and use it in GitHub Desktop.

Select an option

Save icub3d/9e9d77b337d542415fbceafd936e1b31 to your computer and use it in GitHub Desktop.
Kattis quadrant
use std::{
cmp::Ordering,
io::{Read, stdin},
};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut s = s.lines();
let x = s.next().map(|l| l.parse::<isize>().unwrap()).unwrap();
let y = s.next().map(|l| l.parse::<isize>().unwrap()).unwrap();
match (x.cmp(&0), y.cmp(&0)) {
(Ordering::Greater, Ordering::Greater) => println!("1"),
(Ordering::Greater, Ordering::Less) => println!("4"),
(Ordering::Less, Ordering::Less) => println!("3"),
_ => println!("2"),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment