Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- int x,y,lung=0,lmax=0,k=0;
- ifstream fin("bac.txt");
- fin>>x;
- if(x%2==0){ ///daca am pe prima poz par
- lung=1;
- }
- while(fin>>y){
- if(x%2==0 && y%2==0){
- lung++;
- }
- if(x%2==0 && y%2!=0){
- if(lmax<lung){
- lmax=lung;
- k=1;
- }
- else
- if(lung==lmax){
- k++;
- }
- }
- if(x%2!=0 && y%2==0){
- lung=1;
- }
- x=y;
- }
- if(lung>lmax){
- k=1;
- }
- else
- if(lung==lmax){
- k++;
- }
- cout<<k;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement