fork(4) download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long liczba;
  7. long long wynik_total = 0;
  8. long long wynik = 0;
  9. long long tries = 0;
  10. vector<long long>sumuj;
  11.  
  12. while (cin >> liczba)
  13. {
  14. sumuj.push_back(liczba);
  15. wynik += liczba;
  16. if (liczba == 0)
  17. {
  18. for (int i = 0; i < tries; i++)
  19. {
  20. wynik_total += sumuj[i];
  21. }
  22. cout << wynik << "\n";
  23. cout << wynik_total << "\n";
  24. wynik = 0;
  25. }
  26.  
  27. tries++;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty