Cod sursa(job #54403)
Utilizator | Wrong name DjSefu | Data | 24 aprilie 2007 20:07:09 |
---|---|---|---|
Problema | Text | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.59 kb |
#include<stdio.h>
FILE *f=fopen("text.in","r"),
*g=fopen("text.out","w");
char x,y;
long long i,j,n,c,l;
int main()
{ fscanf(f,"%c",&x);
while(!feof(f)){
if(x!=' '){ if(x>='A'&&x<='z') l++;fscanf(f,"%c",&x);}
else { n=0;y=x;fscanf(f,"%c",&x);
while(x!=' '&&!feof(f)){ if(x>='A'&&x<='z') { if(y<'A'||y>'z') n++;
l++;
}
y=x;fscanf(f,"%c",&x);
}
if(n) c+=n;
}
}
fprintf(g,"%ld\n",l/c);
fclose(f);
fclose(g);
return 0;
}