Pagini recente » Cod sursa (job #3194949) | Cod sursa (job #490233) | Monitorul de evaluare | Cod sursa (job #848320) | Cod sursa (job #880015)
Cod sursa(job #880015)
// operatii.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include "fstream"
using namespace std;
int main()
{
ifstream f("operatii.in");
ofstream g("operatii.out");
int nr;
f>>nr;
long long elem;
long long i,max=0,op=0;
for(i=0;i<nr;i++)
{
f>>elem;
if(elem>max)
max=elem;
if(elem==0)
{
op+=max;
max=0;
}
}
op+=max;
g<<op;
return 0;
}