diff options
| author | Kleidi Bujari <mail@4kb.net> | 2025-01-24 12:14:23 -0500 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2025-01-24 12:14:23 -0500 |
| commit | 32f4cb5cbba313b7af2fce46139c04d9469cb72a (patch) | |
| tree | 3cc7da05d4320a8f89a726d67811110771dae1bf /mod/code/cses/problems/1094.cpp | |
| parent | 8271e2b89180578ab4dd9ed9eb37142254e5a148 (diff) | |
| download | depot-32f4cb5cbba313b7af2fce46139c04d9469cb72a.tar.gz depot-32f4cb5cbba313b7af2fce46139c04d9469cb72a.tar.bz2 depot-32f4cb5cbba313b7af2fce46139c04d9469cb72a.zip | |
25-jan sprint
Diffstat (limited to 'mod/code/cses/problems/1094.cpp')
| -rw-r--r-- | mod/code/cses/problems/1094.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mod/code/cses/problems/1094.cpp b/mod/code/cses/problems/1094.cpp new file mode 100644 index 0000000..56f3886 --- /dev/null +++ b/mod/code/cses/problems/1094.cpp @@ -0,0 +1,27 @@ +#include <iostream> +#include <vector> + +using ull = unsigned long long; + +int main() { + ull n; + auto arr = std::vector<ull>{}; + + std::cin >> n; + + std::string type; + while (std::cin >> type) arr.push_back(std::stoi(type)); + + ull count = 0; + auto last = arr[0]; + + for (auto const num : arr) { + if (num > last) { + last = num; + continue; + } + count += last - num; + } + + std::cout << count; +} |
