Skip to content

Instantly share code, notes, and snippets.

@icub3d
Created December 14, 2025 02:26
Show Gist options
  • Select an option

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

Select an option

Save icub3d/aef94d70064f3930835f4efca96dbd77 to your computer and use it in GitHub Desktop.
Kattis earlywinter
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut lines = s.lines();
let (_, d_m) = lines
.next()
.unwrap()
.split_once(' ')
.map(|(l, r)| (l, r.parse::<usize>().unwrap()))
.unwrap();
match lines
.next()
.unwrap()
.split_whitespace()
.map(|v| v.parse::<usize>().unwrap())
.enumerate()
.find(|(_, m)| *m <= d_m)
{
Some((i, _)) => println!("It hadn't snowed this early in {i} years!"),
None => println!("It had never snowed this early!"),
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment