fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int main(){
  5. int a, b = 0, c = 0, d = 1, e = 0, 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 = 1;
  16. }
  17. c = a;
  18. }
  19. else{
  20. b++;
  21. }
  22. }while(cin >> a);
  23. if(e == 0){
  24. cout << 0;
  25. }
  26. else{
  27. cout << d;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5324KB
stdin
0 1 2 3 4 5 6 7 8 9 0


stdout
Standard output is empty