Cod sursa(job #2126473)
| Utilizator | Data | 9 februarie 2018 17:45:56 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <stdio.h>
using namespace std;
FILE *f,*g;
int main()
{
char ch;
int ok=0;
long long nr=0,cuv=0,sol;
f=fopen("text.in","r");
g=fopen("text.out","w");
ch=fgetc(f);
while(!feof(f))
{
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
nr++,ok=1;
else
{
if(ok==1)
cuv++;
ok=0;
}
ch=fgetc(f);
}
if(cuv!=0)
sol=nr/cuv;
else
sol=0;
fprintf(g,"%lld",sol);
fclose(f);
fclose(g);
return 0;
}
