From 96254947699986c59f0dc63d69fd4b76bd3ed43e Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 6 Jul 2026 19:08:08 +0200 Subject: Initial commit --- 01_introductory_problems/increasing_array_1094.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 01_introductory_problems/increasing_array_1094.cpp (limited to '01_introductory_problems/increasing_array_1094.cpp') diff --git a/01_introductory_problems/increasing_array_1094.cpp b/01_introductory_problems/increasing_array_1094.cpp new file mode 100644 index 0000000..314c686 --- /dev/null +++ b/01_introductory_problems/increasing_array_1094.cpp @@ -0,0 +1,12 @@ +#include +#include + +int main() { + long long n, prev{0}, sum{0}; + std::cin >> n; + while (std::cin >> n) { + sum += std::max(0, prev - n); + prev = std::max(prev, n); + } + std::cout << sum << std::endl; +} -- cgit v1.3