Cod sursa(job #308767)
| Utilizator | Data | 28 aprilie 2009 14:53:37 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include<stdio.h>
#include<string.h>
using namespace std;
FILE *f,*s;
char a,b,lit[200]="abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",*c;
long long int nrc,nrl;
int main()
{
f=fopen("text.in","r");
s=fopen("text.out","w");
b=0;
nrl=0;
nrc=0;
while(!feof(f))
{
fscanf(f,"%c",&a);
c=strchr(lit,a);
if(c!=NULL)
{
nrl++;
if(b==0)
nrc++;
b=1;
}
else
b=0;
}
if(nrc==0)
fprintf(s,"0");
else
fprintf(s,"%lld",nrl/nrc);
fclose(s);
return 0;
}