Created
February 15, 2020 16:08
-
-
Save invatainfo/ab247e44e7b7a7fee8045a99a96b7619 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() { | |
ifstream f("numere.in"); | |
int n, x, count = 0; | |
f >> n; | |
while (f >> x) { | |
if (n > x) { | |
count += n - x; | |
} | |
n = x - 1; | |
} | |
count += n; | |
cout << count << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment