fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int main(){
  5. int a, b = 0, c = 0, d = 0, e, f;
  6. cin >> a;
  7. do{
  8. if(a != 0 && b == 0){
  9. f = e;
  10. if(a == e){
  11. d++;
  12. }
  13. e = max ({a, c});
  14. if(e != f){
  15. d = 0;
  16. }
  17. c = a;
  18. }
  19. else{
  20. b++;
  21. }
  22. }while(cin >> a);
  23. cout << d + 1;
  24. return 0;
  25. }
Success #stdin #stdout 0s 5300KB
stdin
1 6 6 99 0 0 0  9 9 9 9 9 9 


stdout
1