Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- using namespace std;
- ifstream fin("bac.in");
- int main() {
- int a, b, c, r = 0, minDif = 1e9;
- fin >> a >> b;
- while (fin >> c) {
- if (b > a && b > c && minDif >= abs(a - c) && r < b) {
- minDif = abs(a - c);
- r = b;
- }
- a = b, b = c;
- }
- if (!r) {
- cout << "nu exista" << endl;
- } else {
- cout << r << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement