Created
November 7, 2017 18:56
-
-
Save jamby77/853717060d7fc88a1e31c430aa3c6296 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> | |
using namespace std; | |
int main(int argc, const char * argv[]) { | |
int N, t, a,b,c; | |
int Nmax = 1000000; // po uslovie N ne moje da e poveche ot tova chislo | |
int tMax = 10000; // vs chislo sled N ne moje da e poveche ot tova | |
cin >> N; | |
cout << "N is: " << N << "\n"; | |
if (N > Nmax) { | |
cout << "N is too big"; | |
return 1; | |
} | |
for (int i = 0; i < N; i++) { | |
cin >> t; | |
cout << "t is: " << t << ", i is: " << i << "\n"; | |
if (t > tMax) { | |
cout << "too big number passed, max number alloed is " << tMax; | |
} | |
if (i == 0) { | |
a = t; | |
cout << "a is: " << a << ", i is: " << i <<"\n"; | |
continue; | |
} | |
if(i == 1) { | |
b = t; | |
cout << "b is: " << b <<", i is: " << i << "\n"; | |
continue; | |
} | |
if (i == 2) { | |
c = t; | |
} else { | |
a = b; | |
b = c; | |
c = t; | |
} | |
cout << "a is: " << a << ", i is: " << i <<"\n"; | |
cout << "b is: " << b << ", i is: " << i <<"\n"; | |
cout << "c is: " << c << ", i is: " << i <<"\n"; | |
if ((a >= b && c >= b) || (b > a && b > c)) { | |
continue; | |
} else { | |
cout << "No\n"; | |
return 0; | |
} | |
} | |
cout << "Yes\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment