Created
November 26, 2018 11:45
-
-
Save invatainfo/fc3f22abc77465eaa3e53545f2afe8bb 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 frecventa[101]; | |
int main() { | |
ifstream f("bac.txt"); | |
int a; | |
while (f >> a) { | |
frecventa[a] = 1; | |
} | |
int maxim = 0, i, nr_elemente = 0; | |
for (i = 0; i <= 100; i++) { | |
if (frecventa[i] == 0) { | |
if (nr_elemente > maxim) { | |
maxim = nr_elemente; | |
} | |
nr_elemente = 0; | |
} | |
nr_elemente += frecventa[i]; | |
} | |
if (nr_elemente > maxim) | |
maxim = nr_elemente; | |
cout << maxim << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment