You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
625 B
Rust
26 lines
625 B
Rust
use std::io::stdin;
|
|
use std::io::BufRead;
|
|
|
|
fn main() {
|
|
let mut prev: Option<i32> = None;
|
|
let mut increased = 0;
|
|
for line in stdin().lock().lines() {
|
|
let cur = line.unwrap().parse::<i32>().unwrap();
|
|
|
|
match prev {
|
|
None => println!("{} (N/A)", cur),
|
|
Some(prev) => {
|
|
if cur > prev {
|
|
increased += 1;
|
|
}
|
|
let evaluate = if cur > prev { "increased" } else { "decreased" };
|
|
println!("{} ({})", cur, evaluate)
|
|
}
|
|
}
|
|
|
|
prev = Some(cur);
|
|
}
|
|
|
|
println!("{}", increased)
|
|
}
|