Created
December 21, 2025 20:48
-
-
Save icub3d/d43a9d89d431bbf50511c55bd5e5a3d9 to your computer and use it in GitHub Desktop.
Kattis stararrangements
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(); | |
| let s = s.trim().parse::<usize>().unwrap(); | |
| println!("{s}:"); | |
| (2..=(s / 2 + 1)) | |
| .flat_map(|n| [(n, n - 1), (n, n)]) | |
| .filter(|(x, y)| s % (x + y) == 0 || s % (x + y) == *x) | |
| .for_each(|(x, y)| println!("{x},{y}")); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment