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