Cod sursa(job #386931)
| Utilizator | Data | 26 ianuarie 2010 12:45:38 | |
|---|---|---|---|
| Problema | Text | Scor | 60 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include<stdio.h>
#include<string.h>
int main()
{
FILE *f=fopen("text.in","r"),*g=fopen("text.out","w");
char a[100000],*p;
int i=0,n,cuv=0,lit=0;
while(!feof(f))
{ fscanf(f,"%c",&a[i]);i++; }
p = strtok (a," ,.-:!?';");
while (p != NULL) {
cuv++; lit+=strlen(p);
// fprintf(g,"%d ",strlen(p));
p = strtok (NULL, " ,.-");
}
// fprintf(g,"\n%d %d",cuv,lit);
fprintf(g,"%d",(lit/cuv));
return 0;
}
