Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ofstream fout("maxim5.out");
- ifstream fin("maxim5.in");
- int x, nr, Max, Max2, nr2 = 100000000;
- int main()
- {
- while(fin >> x) {
- nr++;
- if(!x) {
- if(nr <= nr2) {
- nr2 = nr; nr = 0;
- Max2 = max(Max2, Max); Max = 0;
- }
- else { nr = 0; Max = 0; }
- }
- else if(nr <= nr2 && x > Max) Max = x;
- }
- fout << Max2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement