fork(1) download
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. long long int a;
  9. long long int liczby[100000];
  10. long long int suma_sum=0;
  11. while (cin >> a)
  12. {
  13. long long int suma=0;
  14. int i=0;
  15. liczby [i] = a;
  16. suma = suma + liczby[i];
  17. i++;
  18. while (cin >> a)
  19. {
  20. if (a == 0)
  21. {
  22. if (getchar()==10){break;}
  23. }
  24. else
  25. {
  26. liczby[i] = a;
  27. suma = suma + liczby[i];
  28. i++;
  29. }
  30. }
  31. cout << suma << endl;
  32. suma_sum = suma_sum + suma;
  33. }
  34. cout << suma_sum;
  35. return 0;
  36. }
Success #stdin #stdout 0s 15232KB
stdin
1 9 0
2 0 9 0
stdout
10
11
21