Skip to content

Instantly share code, notes, and snippets.

@icub3d
Created January 12, 2026 19:58
Show Gist options
  • Select an option

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

Select an option

Save icub3d/4c319c7f8b74a3a00cbb4ec065519a10 to your computer and use it in GitHub Desktop.
Kattis mosquito
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
// $M$ , $P$ , $L$ , $E$ , $R$ , $S$ , $N$
for m in s.lines() {
let mut pp = m.split_whitespace().map(|l| l.parse::<usize>().unwrap());
let (mut m, mut p, mut l, e, r, s, n) = (
pp.next().unwrap(),
pp.next().unwrap(),
pp.next().unwrap(),
pp.next().unwrap(),
pp.next().unwrap(),
pp.next().unwrap(),
pp.next().unwrap(),
);
for _ in 0..n {
let nl = m * e;
let np = l / r;
let na = p / s;
l = nl;
p = np;
m = na;
}
println!("{}", m);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment