Cod sursa(job #308758)
| Utilizator | Data | 28 aprilie 2009 14:03:24 | |
|---|---|---|---|
| Problema | Text | Scor | 80 |
| 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,sep[200]="_ 1234567890,.?/!;\'-@#$%^&*(){}[]|:<>+~`\n\0\"",*c1,*c2,*c3;
long long int nrc,nrl;
int main()
{
f=fopen("text.in","r");
s=fopen("text.out","w");
b=' ';
while(!feof(f))
{
fscanf(f,"%c",&a);
c1=strchr(sep,a);
c2=strchr(sep,b);
if(c1!=NULL&&c2==NULL)
nrc++;
if(c1==NULL&&b!='\n')
nrl++;
b=a;
}
if(nrc==0)
fprintf(s,"0");
else
fprintf(s,"%lld",nrl/nrc);
fclose(s);
return 0;
}