Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- ifstream f("bac.txt");
- int t, len = 0, maxlen = 0, maxc = 0;
- while(f>>t){
- if(t % 2 == 0){
- len++;
- }else{
- if(len > 1){
- if(len > maxlen){
- maxc = 1;
- maxlen = len;
- }else if(len == maxlen){
- maxc++;
- }
- }
- len = 0;
- }
- }
- if(len > 1){
- if(len > maxlen) maxc = 1;
- else if(len == maxlen) maxc++;
- }
- cout<<maxc;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement