Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- #include<algorithm>
- using namespace std;
- int n, k, i, aux, nr, S;
- int main()
- {
- ifstream f("plopi2.in");
- ofstream g("plopi2.out");
- f >> n;
- f >> aux;
- for(i = 2; i <= n; i ++)
- {
- f >> nr;
- if(nr > aux)
- {
- S = S + nr - aux;
- ++ k;
- } else
- aux = nr;
- }
- g << k << " " << S;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement