Created
December 5, 2025 19:43
-
-
Save icub3d/9e9d77b337d542415fbceafd936e1b31 to your computer and use it in GitHub Desktop.
Kattis quadrant
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::{ | |
| 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