-
-
Save crumblingstatue/75a4112ddb18a03ce6829bd5ebec4e10 to your computer and use it in GitHub Desktop.
This file contains 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
#![feature(conservative_impl_trait)] | |
fn parse<'a>(input: &'a str) -> impl 'a + Iterator<Item = (u32, u32, u32)> { | |
input.lines().map(|l| { | |
let mut words = l.split_whitespace(); | |
let mut get = || words.next().unwrap().parse().unwrap(); | |
(get(), get(), get()) | |
}) | |
} | |
fn main() { | |
let input = include_str!("../../input/3"); | |
let n_possible = parse(input).filter(|&(a, b, c)| a + b > c && a + c > b && c + b > a).count(); | |
println!("{}", n_possible); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment