From 68c8ab5748048cc7548240fc3a8b3e07f0b05ecb Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Wed, 29 Jan 2025 18:55:41 +0000 Subject: [PATCH] solutions: 116A --- solutions/rust/src/bin/116A.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 solutions/rust/src/bin/116A.rs diff --git a/solutions/rust/src/bin/116A.rs b/solutions/rust/src/bin/116A.rs new file mode 100644 index 0000000..dd4e754 --- /dev/null +++ b/solutions/rust/src/bin/116A.rs @@ -0,0 +1,24 @@ +use std::io; + +fn main() { + let mut s = String::new(); + io::stdin().read_line(&mut s).unwrap(); + + let mut maximum = 0; + let mut people = 0; + + for _ in 0..s.trim().parse::().unwrap() { + let mut s = String::new(); + io::stdin().read_line(&mut s).unwrap(); + + let s: Vec = s.split_whitespace().map(|d| d.parse::().unwrap()).collect(); + + people += s[1]-s[0]; + + if people > maximum { + maximum = people; + } + } + + println!("{}", maximum); +}