Cod sursa(job #2165)
Utilizator | Data | 16 decembrie 2006 09:54:00 | |
---|---|---|---|
Problema | Text | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream.h>
#include <math.h>
ifstream f("text.in");
ofstream g("text.out");
char x[1000000],*p,separator[]=" ,!?-;:";
int nrl=0,nrc=0;
int main()
{
while(!f.eof())
{
f.getline(x,1000000);
p=strtok(x,separator);
while(p)
{
nrl+=strlen(p);
nrc++;
p=strtok(NULL,separator);
}
}
g<<floor(nrl/nrc);
return 0;
}