Cod sursa(job #880013)
Utilizator | Data | 16 februarie 2013 10:00:18 | |
---|---|---|---|
Problema | Operatii | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
// 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;
int elem;
int 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;
}