Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
335 B
1
Indexable
Never

#include <iostream>
using namespace std;

int main()
{
	bool s = 0;
	int n = 1;
	int sum = 0;
	int max = 0;
	
	while (1){
		cin >> n;
		sum += n;
		if (n == 0) {
			if (s == 1) {
				break;
			}
			else if (s == 0) s = 1;
		}
		else {
			s = 0;
			if (n > max) max = n;
		}
	} 
	

	cout << sum;
	
	

}