Advertisement
AlexandruT

[pbInfo] nrnod

Dec 4th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. ifstream fin("nrnod.in");
  5. ofstream fout("nrnod.out");
  6.  
  7. int a[100000], sol;
  8.  
  9. int main()
  10. {
  11.     int i = 2;
  12.     while(fin >> a[i])
  13.     {
  14.         if((a[i] != 0 && a[i - 1] == 0 && a[i - 2] != 0) || (a[i] == 0 && a[i - 1] == 0 && a[i - 2] == 0)) sol++;
  15.         i++;
  16.     }
  17.     fout << sol;
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement