fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n = 0;
  6. int m;
  7. int i = 0;
  8. while (m != -1){
  9. cin >> m;
  10. if (m > n){
  11. i++;
  12. n=m;
  13. }
  14. }
  15. cout << i;
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5308KB
stdin
0
0
2
4
5
9
-1
stdout
4