Advertisement
Guest User

nrnod

a guest
Feb 26th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. /**
  3. 67 51 18 0 0 24 0 0 48 0 11 0 0
  4. 18 24 51 11 48 67
  5. */
  6.  
  7. using namespace std;
  8. ifstream fin("nrnod.in");
  9. ofstream fout("nrnod.out");
  10. int v[10001];
  11. int main()
  12. {
  13. int m=0,i,k,cnt=0;
  14. while(fin>>k)
  15. {
  16. v[++m]=k;
  17. }
  18. for(i=1;i<=m-2;i++)
  19. {
  20. if(v[i]!=0 and v[i+1]==0 and v[i+2]!=0) cnt++;
  21. if(v[i]==0 and v[i+1]==0 and v[i+2]==0) cnt++;
  22.  
  23. }
  24.  
  25. fout<<cnt;
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement