Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. ifstream f("secventapara.in");
  8.  
  9. ofstream g("secventapara.out");
  10.  
  11. int num,scv,scvmax,contor;
  12.  
  13. int main()
  14.  
  15. {
  16.  
  17.    while (f >> num)
  18.  
  19.    {
  20.  
  21.        if (num%2==0)
  22.  
  23.        {
  24.  
  25.            ++scv;
  26.  
  27.        }
  28.  
  29.        else
  30.  
  31.        {
  32.  
  33.            if (scv>scvmax) { scvmax=scv; contor=1; }
  34.  
  35.            else
  36.  
  37.            {
  38.  
  39.                if (scv==scvmax) ++contor;
  40.  
  41.            }
  42.  
  43.            scv=0;
  44.  
  45.        }
  46.  
  47.    }
  48.  
  49.    if (scv>scvmax) { scvmax=scv; contor=1; }
  50.  
  51.    else
  52.  
  53.    {
  54.  
  55.        if (scv==scvmax) ++contor;
  56.  
  57.    }
  58.  
  59.    g << contor;
  60.  
  61.    return 0;
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement